Font size in Report

M

Mike

Hi all,

I have a database which puts together some fields and displays them on a
label in a report.

Depending on how large these comments are, sometimes the text dosent fit in
the label..

Is there a way to automatically re-size the font so that all the text is
show without having to rezise the label?

I cam accross http://www.lebans.com - which has some very good code that
will resize fonts on a form to fit a box, but it doesnt work on a report.

Hope I have explained this properly!

Many Thanks.
Mike Woods.
 
F

fredg

Hi all,

I have a database which puts together some fields and displays them on a
label in a report.

Depending on how large these comments are, sometimes the text dosent fit in
the label..

Is there a way to automatically re-size the font so that all the text is
show without having to rezise the label?

I cam accross http://www.lebans.com - which has some very good code that
will resize fonts on a form to fit a box, but it doesnt work on a report.

Hope I have explained this properly!

Many Thanks.
Mike Woods.

You wrote: "without having to rezise the label"
Is it a label control or a text control?

If it is a text control, then you can do a bit of estimating.
Place the following in the report section's Format event (that the
text control is placed in):

If Len(Me![ControlName]) < 100 Then
Me![Controlname].Fontsize = 12
Elseif Len(Me![ControlName])>101 and Len(Me![ControlName]) <200 Then
Me![ControlName].Fontsize = 10
Else Me![ControlName].Fontsize = 8
End If

Change the criteria as needed for your control.

If it is a label control, then use:
If Len(Me![LabelName].Caption) <100 Then
etc,

A better solution would be to use a text control with it's can grow
property to yes. Then regardless of the amount of text, it will expand
to show all of it.
 
M

Mike

Mike Woods.
You wrote: "without having to rezise the label"
Is it a label control or a text control?

If it is a text control, then you can do a bit of estimating.
Place the following in the report section's Format event (that the
text control is placed in):

If Len(Me![ControlName]) < 100 Then
Me![Controlname].Fontsize = 12
Elseif Len(Me![ControlName])>101 and Len(Me![ControlName]) <200 Then
Me![ControlName].Fontsize = 10
Else Me![ControlName].Fontsize = 8
End If

Change the criteria as needed for your control.

If it is a label control, then use:
If Len(Me![LabelName].Caption) <100 Then
etc,

A better solution would be to use a text control with it's can grow
property to yes. Then regardless of the amount of text, it will expand
to show all of it.


Thanks for your reply.

A little more information.

The database I have created is for a School report, which is set-out in a
standard
format.

The text box which contains the student comment is a fixed size. Some
teachers
write more than others, the standard font size is 12, but for some reports
this could
need reducing down to size 8.

I could estimate, as suggested, but new paragraphs etc. could throw this
off.

Example, sometimes 1000 characters in a single paragraph could fill the text
box.

Other times, 500 characters in multiple paragraphs could fill the text box.

So estimating wont really work..

What I really need is a routine that will detect that the text box has
reached its visible
limit and will automatically reduce the font size to make it all fit.

The sample database AutoSizeFont at www.lebans.com is great, but I can only
get it
to work on a form, and not a report..

Any help much appreciated!! I'm tearing my hair out!

Mike Woods.
 
S

Stephen Lebans

The code on my site works for both Forms and Reports.
http://www.lebans.com/textwidth-height.htm
--

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


Mike said:
Mike Woods.

You wrote: "without having to rezise the label"
Is it a label control or a text control?

If it is a text control, then you can do a bit of estimating.
Place the following in the report section's Format event (that the
text control is placed in):

If Len(Me![ControlName]) < 100 Then
Me![Controlname].Fontsize = 12
Elseif Len(Me![ControlName])>101 and Len(Me![ControlName]) <200 Then
Me![ControlName].Fontsize = 10
Else Me![ControlName].Fontsize = 8
End If

Change the criteria as needed for your control.

If it is a label control, then use:
If Len(Me![LabelName].Caption) <100 Then
etc,

A better solution would be to use a text control with it's can grow
property to yes. Then regardless of the amount of text, it will expand
to show all of it.


Thanks for your reply.

A little more information.

The database I have created is for a School report, which is set-out in a
standard
format.

The text box which contains the student comment is a fixed size. Some
teachers
write more than others, the standard font size is 12, but for some reports
this could
need reducing down to size 8.

I could estimate, as suggested, but new paragraphs etc. could throw this
off.

Example, sometimes 1000 characters in a single paragraph could fill the
text box.

Other times, 500 characters in multiple paragraphs could fill the text
box.

So estimating wont really work..

What I really need is a routine that will detect that the text box has
reached its visible
limit and will automatically reduce the font size to make it all fit.

The sample database AutoSizeFont at www.lebans.com is great, but I can
only get it
to work on a form, and not a report..

Any help much appreciated!! I'm tearing my hair out!

Mike Woods.
 
F

fredg

Mike Woods.

You wrote: "without having to rezise the label"
Is it a label control or a text control?

If it is a text control, then you can do a bit of estimating.
Place the following in the report section's Format event (that the
text control is placed in):

If Len(Me![ControlName]) < 100 Then
Me![Controlname].Fontsize = 12
Elseif Len(Me![ControlName])>101 and Len(Me![ControlName]) <200 Then
Me![ControlName].Fontsize = 10
Else Me![ControlName].Fontsize = 8
End If

Change the criteria as needed for your control.

If it is a label control, then use:
If Len(Me![LabelName].Caption) <100 Then
etc,

A better solution would be to use a text control with it's can grow
property to yes. Then regardless of the amount of text, it will expand
to show all of it.

Thanks for your reply.

A little more information.

The database I have created is for a School report, which is set-out in a
standard
format.

The text box which contains the student comment is a fixed size. Some
teachers
write more than others, the standard font size is 12, but for some reports
this could
need reducing down to size 8.

I could estimate, as suggested, but new paragraphs etc. could throw this
off.

Example, sometimes 1000 characters in a single paragraph could fill the text
box.

Other times, 500 characters in multiple paragraphs could fill the text box.

So estimating wont really work..

What I really need is a routine that will detect that the text box has
reached its visible
limit and will automatically reduce the font size to make it all fit.

The sample database AutoSizeFont at www.lebans.com is great, but I can only
get it
to work on a form, and not a report..

Any help much appreciated!! I'm tearing my hair out!

Mike Woods.

"Fixed Size"? Is it reasonable to try to write the US Constitution in
a text box too small to properly read it? Make the FontSize 4. You
might be able to crowd it all in but it would not be easily readable.
Either limit what the teachers can write or adapt the report to what
they do write. If they write a lot, make the text box bigger, or let
it grow to accommodate what is in it.

In the last paragraph of my original reply I suggested you use an
unbound text control, set to Can Grow. Also set the report's Detail
section to Can Grow (assuming the control is in the Detail Section).
You can have pages of text, use one font size, and still get all of
the text.
Set the control's control source to:
=[FieldA] & " " & [FieldB] & chr(13) & chr(10) & [FieldC] & etc..

Or give it it's value using VBA:
[ControlName] = [FieldA] & " " & [FieldB] & chr(13) & chr(10) &
[FieldC] & etc..

There is a solution, it's just not the one you have preconceived.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top