Re: Conditional Point Size
From: Marshall Barton (marshbarton_at_wowway.com)
Date: 07/04/04
- Next message: anonymous_at_discussions.microsoft.com: "Creating automatically different export paths"
- Previous message: Duane Hookom: "Re: Auto fill control"
- In reply to: Andy: "Re: Conditional Point Size"
- Next in thread: fredg: "Re: Conditional Point Size"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 03 Jul 2004 22:50:00 -0500
Andy wrote:
>Fred/Marshall;
>
>Fred Thank You for Your reply.
>
>Tried the code it didn't work. So I re-read Your instructions a few more
>times before it hit me. The code is for a label. Used it on a label and it
>works.
>
>What is needed is the code for a text box control.
>
>Changed .Caption to .Textbox. No Go.
Just drop the .Caption, don't replace it with anything
>Marsh tried Your air code. It almost works. The For/Next reduces the text
>size to the smallest size in the line. No pause in between. For intFS = 14
>To 8 Step -1. Goes straight to 8. No matter how much text is in the
>control. So that a short description is very tiny.
That sounds like either the text box height is to small for
any of those fontsixes to fit or you've got the If . . .
Then Exit For messed up. Post a Copy/Paste of the code that
doesn't wotk.
-- Marsh MVP [MS Access] >"fredg" <fgutkind@example.invalid> wrote >> On Thu, 1 Jul 2004 22:04:55 -0400, Andy wrote: >> > Tried both. Neither work. >> > >> > It isn't that You are incorrect. I don't know where to place the code. >> > >> > Tried it in "Format Caption", the Format of the Control and in the >Report's >> > On Open Event. >> > >> > Would You be so kind to offer a little more detail? >> > >> > Andy >> > >> >> Andy wrote: >> >>>Have a report that prints to a label. >> >>> >> >>>In some instances the text that is printed is a little long and the >point >> >>>size needs to be reduced. >> >>> >> >>>Tried conditional formatting, (Access 2K), and there isn't any option >for >> >>>Point Size. >> >> >> >> >> > "Marshall Barton" wrote >> >> If you need fine control over the text size, then get >> >> Stephen Leban's TextHeightWidth function at >> >> www.lebans.com >> >> >> >> Assuming you have one text box, the code could be something >> >> like this air code: >> >> >> >> Dim intFS As Integer >> >> For intFS = 12 To 6 Step -1 >> >> If fTextHeight(Me.txtbox) < Me.txtbox.Height _ >> >> Then Exit For >> >> Next intFS >> >> Me.txtbox.FontSize = intFS >> >> Andy >> I was quite specific where to place the code. >> >> > In the Report Section's Format event: < >> >> Here is how. >> >> Let's assume the label is placed in the Report's Detail section. (If >> it's in a Group Header, then change Detail to Group Header.) >> >> In Report Design View, right-click on the Detail bar (or on a blank >> section of the Detail Section). >> Display the section's property ***. >> Click on the Events tab. >> On the OnFormat event line write >> [Event Procedure] >> Click on the button with the 3 dots that appears on that line. >> When the Event code window opens, the cursor will be flashing between >> 2 already existing lines of code. >> Between those 2 lines write: >> >> If Len([ControlName].Caption) > 30 Then >> [ControlName].FontSize = 8 >> Else >> [ControlName].FontSize = 10 >> End If >> >> >> Change [ControlName] to the actual name of the label. >> Change 30 to whatever number of characters you think would be >> suitable. >> Change the FontSizes to whatever sizes you want. >> >> Exit the code window and save the changes. >> Run the report. If the length of the label caption is greater than 30 >> characters (or whatever number you actually entered), then the font >> size will decrease. >> -- >> Fred >> Please only reply to this newsgroup. >> I do not reply to personal email. >
- Next message: anonymous_at_discussions.microsoft.com: "Creating automatically different export paths"
- Previous message: Duane Hookom: "Re: Auto fill control"
- In reply to: Andy: "Re: Conditional Point Size"
- Next in thread: fredg: "Re: Conditional Point Size"
- Messages sorted by: [ date ] [ thread ]