Changing Text Colour within a TextBox

  • Thread starter Thread starter John Ortt
  • Start date Start date
J

John Ortt

I have added the following code to a textbox on my form.

="Total Collected (Outstanding): " &
Format(Sum([TotalReceipts]),"£#,##0.00") & " (" &
Format((Count([Surname])*200)-Sum([TotalReceipts]),"£#,##0.00") & ")"

If possible I would like to have two colours within the text box, White for
"Collected" and Red for "Outstanding".

I realise I could do this with separate text boxes but I would prefer the
precise alignment of using a single box if possible.

If not I'll have to rethink...

Thanks in Advance,

John
 
You will have to rethink your requirements as the standard Access
TextBox control does not support individual character formatting.
You would have to use a Rich Text(RTF) ActiveX control. On top of this
you would have to programmatically build the required RTF encoding at
runtime. If you are comfortable with String manipulations then it si not
too difficult.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Stephen Lebans said:
You will have to rethink your requirements as the standard Access
TextBox control does not support individual character formatting.

Oh well, thanks for letting me know Stephen.
You would have to use a Rich Text(RTF) ActiveX control. On top of this
you would have to programmatically build the required RTF encoding at
runtime. If you are comfortable with String manipulations then it si not
too difficult.

This sounds good but I could not find the Rich Text ActiveX control in the
"More Controls" section on access.
Could it have another name or could I need to install a new add-in in order
to find it?

Thanks again for the help,

John
 
See:
http://www.lebans.com/richtext.htm
RTF2 control is an ActiveX RTF solution written in VC++. The RTF2
control is a complete editing/printing solution for Access 97 or higher.
Autosizing of the RTF2 control is supported for A2K or higher. This is a
full automatic install package. This install package contains 3 required
files for the control to function. The OCX itself, RTF2.OCX and the 2 VC
runtime files, Mfc42.Dll and Msvcrt.Dll. AFAIK the two VC runtime files
will already exist on all installs of Windows
--

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