Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2005

Tip: Looking for answers? Try searching our database.

conditional formatting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jacco Ermers - 16 Feb 2005 14:59 GMT
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
fredg - 16 Feb 2005 17:44 GMT
> Hello everyone, I have searched quit a few webpages and have found several
> result, but non that applied (or I could apply).
[quoted text clipped - 11 lines]
>
> 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.
Signature

Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Jacco Ermers - 16 Feb 2005 18:00 GMT
Wow, works like a charm. If it's that simple... why couldn't I find it in
the books... Thanks again

>> Hello everyone, I have searched quit a few webpages and have found
>> several
[quoted text clipped - 29 lines]
> http://www.lebans.com
> and see what is available there.
Marshall Barton - 16 Feb 2005 20:19 GMT
>Hello everyone, I have searched quit a few webpages and have found several
>result, but non that applied (or I could apply).
[quoted text clipped - 9 lines]
>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

Signature

Marsh
MVP [MS Access]

David C. Holley - 17 Feb 2005 09:48 GMT
Have you tried setting the scroll bars property from NONE to VERTICAL or
BOTH?

> Hello everyone, I have searched quit a few webpages and have found several
> result, but non that applied (or I could apply).
[quoted text clipped - 11 lines]
>
> Thank you in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.