Conditional Point Size

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hi;

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.

Where do I find an example or suggestion how to do this?

Andy
 
Hi;

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.

Where do I find an example or suggestion how to do this?

Andy

You would change the Label's FontSize not the Font's Point Size.
In the Report Section's Format event:

If Len([ControlName].Caption) > 30 Then
[ControlName].FontSize = 8
Else
[ControlName].FontSize = 10
End If
 
Andy said:
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.


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
 
Gentlemen;

Thank You for Your replys.

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
 
Gentlemen;

Thank You for Your replys.

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
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 sheet.
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/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.

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.

Would You be so kind as to offer a little more help?

Andy

fredg said:
Gentlemen;

Thank You for Your replys.

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
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 sheet.
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.
 
Andy said:
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 said:
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.


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 sheet.
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/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.
* snipped **
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 sheet.
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

To do the same thing for a text control you simply check the control's
Value. Since the Value property is the default control property, you
need not explicitly type it:

If Len([ControlName]) > 30 Then
[ControlName].FontSize = 8
etc.
 
Fred/Marsh;

Thank You for Your Help.

Fred Your answer worked:

If Len([txtProdDescript]) > 30 Then
[txtProdDescript].FontSize = 6
Else
[txtProdDescript].FontSize = 12
End If

Discovered that Access 2K, for whatever reason, needs to be exited and
restarted before some code changes work correctly, and this is with all
updates to it and Windows.

Marsh Your answer seems to be more versital, but it still goes directly to
the lowest FontSize:

Dim intFS As Integer
' With txtProdDescript
' .FontName = "ARIAL"
' End With
' Tried the above because the code below changes the Font that is
normally used.
' It didn't work either

For intFS = 14 To 8 Step -1
If TextHeight(Me.txtProdDescript) < Me.txtProdDescript.Height Then Exit
For
' Greater Than stays at the largest FontSize

' For intFS = 14 To 8 Step -1
' If TextHeight(Me.txtProdDescript) > Me.txtProdDescript.Height Then Exit
For
' Less Than Goes directly to Smallest FontSize

' Even reversed it.
' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) < Me.txtProdDescript.Height Then Exit
For
' Less Than goes directly to the smallest FontSize

' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) > Me.txtProdDescript.Height Then Exit
For
' Greater Than goes directly to the largest FontSize

Next intFS
Me.txtProdDescript.FontSize = intFS

Thank You to Both for helping me.

Andy


fredg said:
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.
* snipped **
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 sheet.
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

To do the same thing for a text control you simply check the control's
Value. Since the Value property is the default control property, you
need not explicitly type it:

If Len([ControlName]) > 30 Then
[ControlName].FontSize = 8
etc.
 
Andy said:
Marsh Your answer seems to be more versital, but it still goes directly to
the lowest FontSize:

Dim intFS As Integer
' With txtProdDescript
' .FontName = "ARIAL"
' End With
' Tried the above because the code below changes the Font that is
normally used.
' It didn't work either

For intFS = 14 To 8 Step -1
If TextHeight(Me.txtProdDescript) < Me.txtProdDescript.Height Then Exit
For
' Greater Than stays at the largest FontSize

' For intFS = 14 To 8 Step -1
' If TextHeight(Me.txtProdDescript) > Me.txtProdDescript.Height Then Exit
For
' Less Than Goes directly to Smallest FontSize

' Even reversed it.
' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) < Me.txtProdDescript.Height Then Exit
For
' Less Than goes directly to the smallest FontSize

' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) > Me.txtProdDescript.Height Then Exit
For
' Greater Than goes directly to the largest FontSize

Your test statistics imply that the text box height is not
tall enough for even one line, please double check that.

I also see that you are not using Stephen Lebans fTextHeight
function, but have elected to use the built in TextHeight
method. The built in method has many flaws when used for
this purpose and, while I would not expect the results you
are seeing, I definitely expect it to fail to meet your
needs.
 
Marsh;

The TxtBox height on the Report is 2.625". Plenty of room for multiple
lines.

Did try lebans.com fTxtHeight. One is for Forms only, another
increases/decreases the height of the txtBox in the Report. The box height
cannot exceed 2.625"

Thank You for Your help.

Andy
 
Andy said:
The TxtBox height on the Report is 2.625". Plenty of room for multiple
lines.

Did try lebans.com fTxtHeight. One is for Forms only, another
increases/decreases the height of the txtBox in the Report. The box height
cannot exceed 2.625"


Oh bleep!! Dumb, dumb, dumb, I had a line of code in the
wrong place! Dumb, dumb . . .

For intFS = 14 To 8 Step -1
Me.txtProdDescript.FontSize = intFS
If fTextHeight(Me.txtProdDescript) _
< Me.txtProdDescript.Height Then Exit For
Next intFS

Make sure you're using the TextHeightWidth download at
http://www.lebans.com/textwidth-height.htm
which works fine for reports too.
--
Marsh
MVP [MS Access]


 
Marsh;

I want to apologize for the late THANK YOU.

Won't be able to try Your answer until the weekend. And I will use it with
Lebans' TextHeightWidth

Thank You again.

Andy


Marshall Barton said:
Andy said:
The TxtBox height on the Report is 2.625". Plenty of room for multiple
lines.

Did try lebans.com fTxtHeight. One is for Forms only, another
increases/decreases the height of the txtBox in the Report. The box height
cannot exceed 2.625"


Oh bleep!! Dumb, dumb, dumb, I had a line of code in the
wrong place! Dumb, dumb . . .

For intFS = 14 To 8 Step -1
Me.txtProdDescript.FontSize = intFS
If fTextHeight(Me.txtProdDescript) _
< Me.txtProdDescript.Height Then Exit For
Next intFS

Make sure you're using the TextHeightWidth download at
http://www.lebans.com/textwidth-height.htm
which works fine for reports too.
--
Marsh
MVP [MS Access]


directly
to Then
Exit Then
Exit Then
Exit Then
Exit
 
Marsh;

Thank You.

The ftxtHeight works and works correctly. Incorporated Lebans code.

It is more than is needed and when I learn more I will pare some of it out.

Right now am also trying to incorporate Lebans JustiDirect into the Report's
code also. It's "almost" working.

Text is repeating twice in the rpt's control. (Text displayed on top of
text), Once Justified the other is not.

Believe it has something to do with the functions calling the printer.

Thank You for all Your Help!!!

Andy

Marshall Barton said:
Andy said:
The TxtBox height on the Report is 2.625". Plenty of room for multiple
lines.

Did try lebans.com fTxtHeight. One is for Forms only, another
increases/decreases the height of the txtBox in the Report. The box height
cannot exceed 2.625"


Oh bleep!! Dumb, dumb, dumb, I had a line of code in the
wrong place! Dumb, dumb . . .

For intFS = 14 To 8 Step -1
Me.txtProdDescript.FontSize = intFS
If fTextHeight(Me.txtProdDescript) _
< Me.txtProdDescript.Height Then Exit For
Next intFS

Make sure you're using the TextHeightWidth download at
http://www.lebans.com/textwidth-height.htm
which works fine for reports too.
--
Marsh
MVP [MS Access]


directly
to Then
Exit Then
Exit Then
Exit Then
Exit
 
Justidirect issue:

1) As per the documentation, the original TextBox control's Font color
must be set to WHITE.

2) Certain Postscript Printer Drivers will not work with JustiDirect.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Andy said:
Marsh;

Thank You.

The ftxtHeight works and works correctly. Incorporated Lebans code.

It is more than is needed and when I learn more I will pare some of it out.

Right now am also trying to incorporate Lebans JustiDirect into the Report's
code also. It's "almost" working.

Text is repeating twice in the rpt's control. (Text displayed on top of
text), Once Justified the other is not.

Believe it has something to do with the functions calling the printer.

Thank You for all Your Help!!!

Andy

box
height
cannot exceed 2.625"


Oh bleep!! Dumb, dumb, dumb, I had a line of code in the
wrong place! Dumb, dumb . . .

For intFS = 14 To 8 Step -1
Me.txtProdDescript.FontSize = intFS
If fTextHeight(Me.txtProdDescript) _
< Me.txtProdDescript.Height Then Exit For
Next intFS

Make sure you're using the TextHeightWidth download at
http://www.lebans.com/textwidth-height.htm
which works fine for reports too.
--
Marsh
MVP [MS Access]


Marsh Your answer seems to be more versital, but it still goes directly
to
the lowest FontSize:

Dim intFS As Integer
' With txtProdDescript
' .FontName = "ARIAL"
' End With
' Tried the above because the code below changes the Font that is
normally used.
' It didn't work either

For intFS = 14 To 8 Step -1
If TextHeight(Me.txtProdDescript) <
Me.txtProdDescript.Height
Me.txtProdDescript.Height
Me.txtProdDescript.Height
Me.txtProdDescript.Height
 
Marsh/Stephen;

THANK YOU BOTH!!!

Andy

Stephen Lebans said:
Justidirect issue:

1) As per the documentation, the original TextBox control's Font color
must be set to WHITE.

2) Certain Postscript Printer Drivers will not work with JustiDirect.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Andy said:
Marsh;

Thank You.

The ftxtHeight works and works correctly. Incorporated Lebans code.

It is more than is needed and when I learn more I will pare some of it out.

Right now am also trying to incorporate Lebans JustiDirect into the Report's
code also. It's "almost" working.

Text is repeating twice in the rpt's control. (Text displayed on top of
text), Once Justified the other is not.

Believe it has something to do with the functions calling the printer.

Thank You for all Your Help!!!

Andy

Marshall Barton said:
Andy wrote:
The TxtBox height on the Report is 2.625". Plenty of room for multiple
lines.

Did try lebans.com fTxtHeight. One is for Forms only, another
increases/decreases the height of the txtBox in the Report. The
box
height
cannot exceed 2.625"


Oh bleep!! Dumb, dumb, dumb, I had a line of code in the
wrong place! Dumb, dumb . . .

For intFS = 14 To 8 Step -1
Me.txtProdDescript.FontSize = intFS
If fTextHeight(Me.txtProdDescript) _
< Me.txtProdDescript.Height Then Exit For
Next intFS

Make sure you're using the TextHeightWidth download at
http://www.lebans.com/textwidth-height.htm
which works fine for reports too.
--
Marsh
MVP [MS Access]



Marsh Your answer seems to be more versital, but it still goes directly
to
the lowest FontSize:

Dim intFS As Integer
' With txtProdDescript
' .FontName = "ARIAL"
' End With
' Tried the above because the code below changes the Font that is
normally used.
' It didn't work either

For intFS = 14 To 8 Step -1
If TextHeight(Me.txtProdDescript) <
Me.txtProdDescript.Height
Then
Exit
For
' Greater Than stays at the largest FontSize

' For intFS = 14 To 8 Step -1
' If TextHeight(Me.txtProdDescript) >
Me.txtProdDescript.Height
Then
Exit
For
' Less Than Goes directly to Smallest FontSize

' Even reversed it.
' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) <
Me.txtProdDescript.Height
Then
Exit
For
' Less Than goes directly to the smallest FontSize

' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) >
Me.txtProdDescript.Height
Then
Exit
For
' Greater Than goes directly to the largest FontSize

"Marshall Barton" wrote
Your test statistics imply that the text box height is not
tall enough for even one line, please double check that.

I also see that you are not using Stephen Lebans fTextHeight
function, but have elected to use the built in TextHeight
method. The built in method has many flaws when used for
this purpose and, while I would not expect the results you
are seeing, I definitely expect it to fail to meet your
needs.
 
Marsh/Stephen;

Getting Odd behavior.

The report prints to a "Label". It contains 8 controls, 4 on the upper
portion, 4 on the lower.

The fTextHeight works for all of them, when the JustiDirect is added for all
the controls the Upper 4 are blank.

Used:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Call Justi1.fRecordDetail(Me, "txtProdDescript1", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript2", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript3", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript4", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript5", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript6", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript7", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript8", PrintCount)

End Sub
Tested it by Remming out last 4 and the upper 4 controls text reappears.

Any ideas?

Andy
PS. Don't know if this is any help but this is also included on the Detail
on Format Event:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intFS As Integer

For intFS = 14 To 8 Step -1
Me.txtProdDescript1.FontSize = intFS
Me.txtProdDescript2.FontSize = intFS
Me.txtProdDescript3.FontSize = intFS
Me.txtProdDescript4.FontSize = intFS
Me.txtProdDescript5.FontSize = intFS
Me.txtProdDescript6.FontSize = intFS
Me.txtProdDescript7.FontSize = intFS
Me.txtProdDescript8.FontSize = intFS

If fTextHeight(Me.txtProdDescript1) < Me.txtProdDescript1.Height Then
Exit For
If fTextHeight(Me.txtProdDescript2) < Me.txtProdDescript2.Height Then
Exit For
If fTextHeight(Me.txtProdDescript3) < Me.txtProdDescript3.Height Then
Exit For
If fTextHeight(Me.txtProdDescript4) < Me.txtProdDescript4.Height Then
Exit For
If fTextHeight(Me.txtProdDescript5) < Me.txtProdDescript5.Height Then
Exit For
If fTextHeight(Me.txtProdDescript6) < Me.txtProdDescript6.Height Then
Exit For
If fTextHeight(Me.txtProdDescript7) < Me.txtProdDescript7.Height Then
Exit For
If fTextHeight(Me.txtProdDescript8) < Me.txtProdDescript8.Height Then
Exit For
Next intFS
End Sub

Stephen Lebans said:
Justidirect issue:

1) As per the documentation, the original TextBox control's Font color
must be set to WHITE.

2) Certain Postscript Printer Drivers will not work with JustiDirect.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Andy said:
Marsh;

Thank You.

The ftxtHeight works and works correctly. Incorporated Lebans code.

It is more than is needed and when I learn more I will pare some of it out.

Right now am also trying to incorporate Lebans JustiDirect into the Report's
code also. It's "almost" working.

Text is repeating twice in the rpt's control. (Text displayed on top of
text), Once Justified the other is not.

Believe it has something to do with the functions calling the printer.

Thank You for all Your Help!!!

Andy

Marshall Barton said:
Andy wrote:
The TxtBox height on the Report is 2.625". Plenty of room for multiple
lines.

Did try lebans.com fTxtHeight. One is for Forms only, another
increases/decreases the height of the txtBox in the Report. The
box
height
cannot exceed 2.625"


Oh bleep!! Dumb, dumb, dumb, I had a line of code in the
wrong place! Dumb, dumb . . .

For intFS = 14 To 8 Step -1
Me.txtProdDescript.FontSize = intFS
If fTextHeight(Me.txtProdDescript) _
< Me.txtProdDescript.Height Then Exit For
Next intFS

Make sure you're using the TextHeightWidth download at
http://www.lebans.com/textwidth-height.htm
which works fine for reports too.
--
Marsh
MVP [MS Access]



Marsh Your answer seems to be more versital, but it still goes directly
to
the lowest FontSize:

Dim intFS As Integer
' With txtProdDescript
' .FontName = "ARIAL"
' End With
' Tried the above because the code below changes the Font that is
normally used.
' It didn't work either

For intFS = 14 To 8 Step -1
If TextHeight(Me.txtProdDescript) <
Me.txtProdDescript.Height
Then
Exit
For
' Greater Than stays at the largest FontSize

' For intFS = 14 To 8 Step -1
' If TextHeight(Me.txtProdDescript) >
Me.txtProdDescript.Height
Then
Exit
For
' Less Than Goes directly to Smallest FontSize

' Even reversed it.
' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) <
Me.txtProdDescript.Height
Then
Exit
For
' Less Than goes directly to the smallest FontSize

' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) >
Me.txtProdDescript.Height
Then
Exit
For
' Greater Than goes directly to the largest FontSize

"Marshall Barton" wrote
Your test statistics imply that the text box height is not
tall enough for even one line, please double check that.

I also see that you are not using Stephen Lebans fTextHeight
function, but have elected to use the built in TextHeight
method. The built in method has many flaws when used for
this purpose and, while I would not expect the results you
are seeing, I definitely expect it to fail to meet your
needs.
 
Look again at the source code behind the sample reports. You have to
declare a seperate instance of the JustiClass for EACH TextBox control
you want to justify.

Dim Justi1 As New clsJustifyText
Dim Justi2 As New clsJustifyText

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Call Justi1.fRecordSection(Me, Me.txtTestmemo, PrintCount)
Call Justi2.fRecordSection(Me, Me.txtTestMemo2, PrintCount)
End Sub

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Andy said:
Marsh/Stephen;

Getting Odd behavior.

The report prints to a "Label". It contains 8 controls, 4 on the upper
portion, 4 on the lower.

The fTextHeight works for all of them, when the JustiDirect is added for all
the controls the Upper 4 are blank.

Used:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Call Justi1.fRecordDetail(Me, "txtProdDescript1", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript2", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript3", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript4", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript5", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript6", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript7", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript8", PrintCount)

End Sub
Tested it by Remming out last 4 and the upper 4 controls text reappears.

Any ideas?

Andy
PS. Don't know if this is any help but this is also included on the Detail
on Format Event:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intFS As Integer

For intFS = 14 To 8 Step -1
Me.txtProdDescript1.FontSize = intFS
Me.txtProdDescript2.FontSize = intFS
Me.txtProdDescript3.FontSize = intFS
Me.txtProdDescript4.FontSize = intFS
Me.txtProdDescript5.FontSize = intFS
Me.txtProdDescript6.FontSize = intFS
Me.txtProdDescript7.FontSize = intFS
Me.txtProdDescript8.FontSize = intFS

If fTextHeight(Me.txtProdDescript1) < Me.txtProdDescript1.Height Then
Exit For
If fTextHeight(Me.txtProdDescript2) < Me.txtProdDescript2.Height Then
Exit For
If fTextHeight(Me.txtProdDescript3) < Me.txtProdDescript3.Height Then
Exit For
If fTextHeight(Me.txtProdDescript4) < Me.txtProdDescript4.Height Then
Exit For
If fTextHeight(Me.txtProdDescript5) < Me.txtProdDescript5.Height Then
Exit For
If fTextHeight(Me.txtProdDescript6) < Me.txtProdDescript6.Height Then
Exit For
If fTextHeight(Me.txtProdDescript7) < Me.txtProdDescript7.Height Then
Exit For
If fTextHeight(Me.txtProdDescript8) < Me.txtProdDescript8.Height Then
Exit For
Next intFS
End Sub

"Stephen Lebans"
wrote in message news:[email protected]...
Justidirect issue:

1) As per the documentation, the original TextBox control's Font color
must be set to WHITE.

2) Certain Postscript Printer Drivers will not work with JustiDirect.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Andy said:
Marsh;

Thank You.

The ftxtHeight works and works correctly. Incorporated Lebans code.

It is more than is needed and when I learn more I will pare some
of it
out.
Right now am also trying to incorporate Lebans JustiDirect into
the
Report's
code also. It's "almost" working.

Text is repeating twice in the rpt's control. (Text displayed on
top
of
text), Once Justified the other is not.

Believe it has something to do with the functions calling the printer.

Thank You for all Your Help!!!

Andy

Andy wrote:
The TxtBox height on the Report is 2.625". Plenty of room for multiple
lines.

Did try lebans.com fTxtHeight. One is for Forms only, another
increases/decreases the height of the txtBox in the Report.
The
box
height
cannot exceed 2.625"


Oh bleep!! Dumb, dumb, dumb, I had a line of code in the
wrong place! Dumb, dumb . . .

For intFS = 14 To 8 Step -1
Me.txtProdDescript.FontSize = intFS
If fTextHeight(Me.txtProdDescript) _
< Me.txtProdDescript.Height Then Exit For
Next intFS

Make sure you're using the TextHeightWidth download at
http://www.lebans.com/textwidth-height.htm
which works fine for reports too.
--
Marsh
MVP [MS Access]



Marsh Your answer seems to be more versital, but it still goes
directly
to
the lowest FontSize:

Dim intFS As Integer
' With txtProdDescript
' .FontName = "ARIAL"
' End With
' Tried the above because the code below changes the
Font
that is
normally used.
' It didn't work either

For intFS = 14 To 8 Step -1
If TextHeight(Me.txtProdDescript) < Me.txtProdDescript.Height
Then
Exit
For
' Greater Than stays at the largest FontSize

' For intFS = 14 To 8 Step -1
' If TextHeight(Me.txtProdDescript) > Me.txtProdDescript.Height
Then
Exit
For
' Less Than Goes directly to Smallest FontSize

' Even reversed it.
' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) < Me.txtProdDescript.Height
Then
Exit
For
' Less Than goes directly to the smallest FontSize

' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) > Me.txtProdDescript.Height
Then
Exit
For
' Greater Than goes directly to the largest FontSize

"Marshall Barton" wrote
Your test statistics imply that the text box height is not
tall enough for even one line, please double check that.

I also see that you are not using Stephen Lebans fTextHeight
function, but have elected to use the built in TextHeight
method. The built in method has many flaws when used for
this purpose and, while I would not expect the results you
are seeing, I definitely expect it to fail to meet your
needs.
 
Stephen;

When I seen Your reply said "YaHoo" and got right to work.

Added:
Dim Justi1 As New clsJustifyText TO Dim Justi8 As New clsJustifyText

Added:
Call Justi1.fRecordSection(Me, Me.txtTestmemo, PrintCount) TO Call
Justi8.fRecordSection(Me, Me.txtTestmemo, PrintCount)

Text only populated the first txtControl on the report all the rest were
blank.

Know enough to know that something was missing.

Added:
Option Compare Database
Option Explicit
Dim Justi1 As New clsJustifyText TO Dim Justi8 As New clsJustifyText

All of the controls went blank.

Know enough to know that something was missing.
Noticed that I had:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Call Justi1.fRecordSection(Me, "txtTestmemo", PrintCount)

While You had:
Call Justi1.fRecordSection(Me, Me.txtTestmemo, PrintCount)

Tried that. Still Blank.

Know enough to know that something was missing.
It was:
Private Sub Report_Page()
Dim myBool As Boolean
myBool = Justi1.fJustiDirect(Me)
Added 1 TO 8.

It all works.

Thank You Stephen.
Thank You Marsh.

"Live Long and Prosper."

Andy


Stephen Lebans said:
Look again at the source code behind the sample reports. You have to
declare a seperate instance of the JustiClass for EACH TextBox control
you want to justify.

Dim Justi1 As New clsJustifyText
Dim Justi2 As New clsJustifyText

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Call Justi1.fRecordSection(Me, Me.txtTestmemo, PrintCount)
Call Justi2.fRecordSection(Me, Me.txtTestMemo2, PrintCount)
End Sub

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Andy said:
Marsh/Stephen;

Getting Odd behavior.

The report prints to a "Label". It contains 8 controls, 4 on the upper
portion, 4 on the lower.

The fTextHeight works for all of them, when the JustiDirect is added for all
the controls the Upper 4 are blank.

Used:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Call Justi1.fRecordDetail(Me, "txtProdDescript1", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript2", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript3", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript4", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript5", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript6", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript7", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript8", PrintCount)

End Sub
Tested it by Remming out last 4 and the upper 4 controls text reappears.

Any ideas?

Andy
PS. Don't know if this is any help but this is also included on the Detail
on Format Event:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intFS As Integer

For intFS = 14 To 8 Step -1
Me.txtProdDescript1.FontSize = intFS
Me.txtProdDescript2.FontSize = intFS
Me.txtProdDescript3.FontSize = intFS
Me.txtProdDescript4.FontSize = intFS
Me.txtProdDescript5.FontSize = intFS
Me.txtProdDescript6.FontSize = intFS
Me.txtProdDescript7.FontSize = intFS
Me.txtProdDescript8.FontSize = intFS

If fTextHeight(Me.txtProdDescript1) < Me.txtProdDescript1.Height Then
Exit For
If fTextHeight(Me.txtProdDescript2) < Me.txtProdDescript2.Height Then
Exit For
If fTextHeight(Me.txtProdDescript3) < Me.txtProdDescript3.Height Then
Exit For
If fTextHeight(Me.txtProdDescript4) < Me.txtProdDescript4.Height Then
Exit For
If fTextHeight(Me.txtProdDescript5) < Me.txtProdDescript5.Height Then
Exit For
If fTextHeight(Me.txtProdDescript6) < Me.txtProdDescript6.Height Then
Exit For
If fTextHeight(Me.txtProdDescript7) < Me.txtProdDescript7.Height Then
Exit For
If fTextHeight(Me.txtProdDescript8) < Me.txtProdDescript8.Height Then
Exit For
Next intFS
End Sub

"Stephen Lebans"
wrote in message news:[email protected]...
Justidirect issue:

1) As per the documentation, the original TextBox control's Font color
must be set to WHITE.

2) Certain Postscript Printer Drivers will not work with JustiDirect.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Marsh;

Thank You.

The ftxtHeight works and works correctly. Incorporated Lebans code.

It is more than is needed and when I learn more I will pare some of it
out.

Right now am also trying to incorporate Lebans JustiDirect into the
Report's
code also. It's "almost" working.

Text is repeating twice in the rpt's control. (Text displayed on top
of
text), Once Justified the other is not.

Believe it has something to do with the functions calling the printer.

Thank You for all Your Help!!!

Andy

Andy wrote:
The TxtBox height on the Report is 2.625". Plenty of room for
multiple
lines.

Did try lebans.com fTxtHeight. One is for Forms only, another
increases/decreases the height of the txtBox in the Report. The
box
height
cannot exceed 2.625"


Oh bleep!! Dumb, dumb, dumb, I had a line of code in the
wrong place! Dumb, dumb . . .

For intFS = 14 To 8 Step -1
Me.txtProdDescript.FontSize = intFS
If fTextHeight(Me.txtProdDescript) _
< Me.txtProdDescript.Height Then Exit For
Next intFS

Make sure you're using the TextHeightWidth download at
http://www.lebans.com/textwidth-height.htm
which works fine for reports too.
--
Marsh
MVP [MS Access]



Marsh Your answer seems to be more versital, but it still goes
directly
to
the lowest FontSize:

Dim intFS As Integer
' With txtProdDescript
' .FontName = "ARIAL"
' End With
' Tried the above because the code below changes the Font
that is
normally used.
' It didn't work either

For intFS = 14 To 8 Step -1
If TextHeight(Me.txtProdDescript) <
Me.txtProdDescript.Height
Then
Exit
For
' Greater Than stays at the largest FontSize

' For intFS = 14 To 8 Step -1
' If TextHeight(Me.txtProdDescript) >
Me.txtProdDescript.Height
Then
Exit
For
' Less Than Goes directly to Smallest FontSize

' Even reversed it.
' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) <
Me.txtProdDescript.Height
Then
Exit
For
' Less Than goes directly to the smallest FontSize

' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) >
Me.txtProdDescript.Height
Then
Exit
For
' Greater Than goes directly to the largest FontSize

"Marshall Barton" wrote
Your test statistics imply that the text box height is not
tall enough for even one line, please double check that.

I also see that you are not using Stephen Lebans fTextHeight
function, but have elected to use the built in TextHeight
method. The built in method has many flaws when used for
this purpose and, while I would not expect the results you
are seeing, I definitely expect it to fail to meet your
needs.
 
Andy you're just like me. Rather then spend 10 minutes studing the
"manual" you'll spend an hour trying to do it yourself!
:-)
Glad you finally got it working.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Andy said:
Stephen;

When I seen Your reply said "YaHoo" and got right to work.

Added:
Dim Justi1 As New clsJustifyText TO Dim Justi8 As New clsJustifyText

Added:
Call Justi1.fRecordSection(Me, Me.txtTestmemo, PrintCount) TO Call
Justi8.fRecordSection(Me, Me.txtTestmemo, PrintCount)

Text only populated the first txtControl on the report all the rest were
blank.

Know enough to know that something was missing.

Added:
Option Compare Database
Option Explicit
Dim Justi1 As New clsJustifyText TO Dim Justi8 As New clsJustifyText

All of the controls went blank.

Know enough to know that something was missing.
Noticed that I had:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Call Justi1.fRecordSection(Me, "txtTestmemo", PrintCount)

While You had:
Call Justi1.fRecordSection(Me, Me.txtTestmemo, PrintCount)

Tried that. Still Blank.

Know enough to know that something was missing.
It was:
Private Sub Report_Page()
Dim myBool As Boolean
myBool = Justi1.fJustiDirect(Me)
Added 1 TO 8.

It all works.

Thank You Stephen.
Thank You Marsh.

"Live Long and Prosper."

Andy


"Stephen Lebans"
wrote in message news:%[email protected]...
Look again at the source code behind the sample reports. You have to
declare a seperate instance of the JustiClass for EACH TextBox control
you want to justify.

Dim Justi1 As New clsJustifyText
Dim Justi2 As New clsJustifyText

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Call Justi1.fRecordSection(Me, Me.txtTestmemo, PrintCount)
Call Justi2.fRecordSection(Me, Me.txtTestMemo2, PrintCount)
End Sub

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Andy said:
Marsh/Stephen;

Getting Odd behavior.

The report prints to a "Label". It contains 8 controls, 4 on the upper
portion, 4 on the lower.

The fTextHeight works for all of them, when the JustiDirect is
added
for all
the controls the Upper 4 are blank.

Used:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Call Justi1.fRecordDetail(Me, "txtProdDescript1", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript2", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript3", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript4", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript5", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript6", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript7", PrintCount)
Call Justi1.fRecordDetail(Me, "txtProdDescript8", PrintCount)

End Sub
Tested it by Remming out last 4 and the upper 4 controls text reappears.

Any ideas?

Andy
PS. Don't know if this is any help but this is also included on
the
Detail
on Format Event:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intFS As Integer

For intFS = 14 To 8 Step -1
Me.txtProdDescript1.FontSize = intFS
Me.txtProdDescript2.FontSize = intFS
Me.txtProdDescript3.FontSize = intFS
Me.txtProdDescript4.FontSize = intFS
Me.txtProdDescript5.FontSize = intFS
Me.txtProdDescript6.FontSize = intFS
Me.txtProdDescript7.FontSize = intFS
Me.txtProdDescript8.FontSize = intFS

If fTextHeight(Me.txtProdDescript1) <
Me.txtProdDescript1.Height
Then
Exit For
If fTextHeight(Me.txtProdDescript2) <
Me.txtProdDescript2.Height
Then
Exit For
If fTextHeight(Me.txtProdDescript3) <
Me.txtProdDescript3.Height
Then
Exit For
If fTextHeight(Me.txtProdDescript4) <
Me.txtProdDescript4.Height
Then
Exit For
If fTextHeight(Me.txtProdDescript5) <
Me.txtProdDescript5.Height
Then
Exit For
If fTextHeight(Me.txtProdDescript6) <
Me.txtProdDescript6.Height
Then
Exit For
If fTextHeight(Me.txtProdDescript7) <
Me.txtProdDescript7.Height
Then
Exit For
If fTextHeight(Me.txtProdDescript8) <
Me.txtProdDescript8.Height
Then
Exit For
Next intFS
End Sub

"Stephen Lebans"
wrote in message Justidirect issue:

1) As per the documentation, the original TextBox control's Font color
must be set to WHITE.

2) Certain Postscript Printer Drivers will not work with JustiDirect.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Marsh;

Thank You.

The ftxtHeight works and works correctly. Incorporated Lebans code.

It is more than is needed and when I learn more I will pare
some
of it
out.

Right now am also trying to incorporate Lebans JustiDirect
into
the
Report's
code also. It's "almost" working.

Text is repeating twice in the rpt's control. (Text displayed
on
top
of
text), Once Justified the other is not.

Believe it has something to do with the functions calling the printer.

Thank You for all Your Help!!!

Andy

Andy wrote:
The TxtBox height on the Report is 2.625". Plenty of room for
multiple
lines.

Did try lebans.com fTxtHeight. One is for Forms only, another
increases/decreases the height of the txtBox in the Report. The
box
height
cannot exceed 2.625"


Oh bleep!! Dumb, dumb, dumb, I had a line of code in the
wrong place! Dumb, dumb . . .

For intFS = 14 To 8 Step -1
Me.txtProdDescript.FontSize = intFS
If fTextHeight(Me.txtProdDescript) _
< Me.txtProdDescript.Height Then Exit For
Next intFS

Make sure you're using the TextHeightWidth download at
http://www.lebans.com/textwidth-height.htm
which works fine for reports too.
--
Marsh
MVP [MS Access]



Marsh Your answer seems to be more versital, but it
still
goes
directly
to
the lowest FontSize:

Dim intFS As Integer
' With txtProdDescript
' .FontName = "ARIAL"
' End With
' Tried the above because the code below changes the Font
that is
normally used.
' It didn't work either

For intFS = 14 To 8 Step -1
If TextHeight(Me.txtProdDescript) <
Me.txtProdDescript.Height
Then
Exit
For
' Greater Than stays at the largest FontSize

' For intFS = 14 To 8 Step -1
' If TextHeight(Me.txtProdDescript) >
Me.txtProdDescript.Height
Then
Exit
For
' Less Than Goes directly to Smallest FontSize

' Even reversed it.
' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) <
Me.txtProdDescript.Height
Then
Exit
For
' Less Than goes directly to the smallest FontSize

' For intFS = 8 To 14 Step 1
' If TextHeight(Me.txtProdDescript) >
Me.txtProdDescript.Height
Then
Exit
For
' Greater Than goes directly to the largest FontSize

"Marshall Barton" wrote
Your test statistics imply that the text box height is not
tall enough for even one line, please double check that.

I also see that you are not using Stephen Lebans fTextHeight
function, but have elected to use the built in TextHeight
method. The built in method has many flaws when used for
this purpose and, while I would not expect the results you
are seeing, I definitely expect it to fail to meet your
needs.
 
Back
Top