Can I set fonts inside code?

  • Thread starter Thread starter Laurel
  • Start date Start date
L

Laurel

I have a function that returns String1 & String2 & String3.

Depending on other conditions, I would sometimes like String2 to show in
italics, and sometimes in red, and sometimes both. Can I do this from code?
 
Assuming that String2 is in its own control

String2Field.FontItalic = True
String2Field.ForeColor = vbRed
 
No, it's not in it's on control. The function returns 3 strings
concatenated together. The function returns to one control. So I want the
middle piece of the long string to be italic and/or red.

So

ls_string = string1 & string2 & string3

fncFunction = ls_string

End Function

on my report the control Names has a source of fncFunction.
 
Laurel said:
No, it's not in it's on control. The function returns 3 strings
concatenated together. The function returns to one control. So I want
the middle piece of the long string to be italic and/or red.

You would need to use a Rich Text Box ActiveX Control. There's one that
comes, or used to come, with the Office Developer Edition, and may come with
the Visual Studio Tools for Office which is where the Runtime for Access
2003 is found. There are various sources for third-party controls that can
handle this, the best price I know about being "free" from MVP Stephen
Lebans... it is at http://www.lebans.com/richtext.htm on his site
http://www.lebans.com which is brimful of extremely useful information and
downloads. The drawback? Support only by asking questions in the
newsgroups and hoping they will come to his attention or the attention of
someone who's used the item and knows the answer you seek. For a price, you
can get one from FMS, Inc. http://www.fmsinc.com. Check their support
policies.

Or, you could move to Access 2007, which has some additional support for
formatting in standard Text Boxes. But I wouldn't recommend making that
move until you see feedback on Service Pack 1, which has not yet been
released.

Larry Linson
Microsoft Access MVP
 
Back
Top