conditional formatting

  • Thread starter Thread starter Jacco Ermers
  • Start date Start date
J

Jacco Ermers

Hello everyone, I have searched quit a few webpages and have found several
result, but non that applied (or I could apply).

I have a report of my logbook in which there is a remarks-textbox. The size
of this box is fixed, but sometimes there is too much text to fit. I want to
apply a conditional formatting rule which changes the font-size based on the
amount of text used. Since this is not a option within access 2002 itself I
know I have to code it in VBA.

There already is use of a expression to combine the text needed inside the
textbox. Now I would like to get some help to use VBA to count the number of
letters used within this text box and then apply a change in fontsize
depending on that number. Can anyone help me?

Thank you in advance
 
Hello everyone, I have searched quit a few webpages and have found several
result, but non that applied (or I could apply).

I have a report of my logbook in which there is a remarks-textbox. The size
of this box is fixed, but sometimes there is too much text to fit. I want to
apply a conditional formatting rule which changes the font-size based on the
amount of text used. Since this is not a option within access 2002 itself I
know I have to code it in VBA.

There already is use of a expression to combine the text needed inside the
textbox. Now I would like to get some help to use VBA to count the number of
letters used within this text box and then apply a change in fontsize
depending on that number. Can anyone help me?

Thank you in advance

In the section's Format event:
If Len([FieldName])> 100 then
[FieldName].FontSize = 8
Else
[FieldName].FontSize = 10
End If

Also take a look at
http://www.lebans.com
and see what is available there.
 
Wow, works like a charm. If it's that simple... why couldn't I find it in
the books... Thanks again
fredg said:
Hello everyone, I have searched quit a few webpages and have found
several
result, but non that applied (or I could apply).

I have a report of my logbook in which there is a remarks-textbox. The
size
of this box is fixed, but sometimes there is too much text to fit. I want
to
apply a conditional formatting rule which changes the font-size based on
the
amount of text used. Since this is not a option within access 2002 itself
I
know I have to code it in VBA.

There already is use of a expression to combine the text needed inside
the
textbox. Now I would like to get some help to use VBA to count the number
of
letters used within this text box and then apply a change in fontsize
depending on that number. Can anyone help me?

Thank you in advance

In the section's Format event:
If Len([FieldName])> 100 then
[FieldName].FontSize = 8
Else
[FieldName].FontSize = 10
End If

Also take a look at
http://www.lebans.com
and see what is available there.
 
Jacco said:
Hello everyone, I have searched quit a few webpages and have found several
result, but non that applied (or I could apply).

I have a report of my logbook in which there is a remarks-textbox. The size
of this box is fixed, but sometimes there is too much text to fit. I want to
apply a conditional formatting rule which changes the font-size based on the
amount of text used. Since this is not a option within access 2002 itself I
know I have to code it in VBA.

There already is use of a expression to combine the text needed inside the
textbox. Now I would like to get some help to use VBA to count the number of
letters used within this text box and then apply a change in fontsize
depending on that number.


The precise way to do that is to use the TextHeightWidth
function at www.lebans.com

For k = 12 To 5 Step -1
textbox.FontSize = k
If fTextHeight(textbox) <= textbox.Height Then Exit For
Next k
 
Back
Top