Can you Change Certain Word Text Color in Concatenated Text Box?

S

Swim Dad

Good Morning,
Thanks in advance for any help.
Using Access 2003 and I am by no means a code wizard.
I have a report that contains a text box. In the text box I would like to
change the color of a concatenated field (i.e. the field name "Person"). Is
this possible?

This is my current statement:

="Total for " & ([Person]) & "= " & Format(Sum([Total_Amount]),"Currency")

Results in: "Total for Smith = $1.00" I would like "Smith" only to be
something different.
 
D

Dirk Goldgar

Swim Dad said:
Good Morning,
Thanks in advance for any help.
Using Access 2003 and I am by no means a code wizard.
I have a report that contains a text box. In the text box I would like to
change the color of a concatenated field (i.e. the field name "Person").
Is
this possible?

This is my current statement:

="Total for " & ([Person]) & "= " & Format(Sum([Total_Amount]),"Currency")

Results in: "Total for Smith = $1.00" I would like "Smith" only to be
something different.


You can't do this in a normal text box. You might conceivably do it in a
Rich Textbox, which is not a native Access control. If you want to pursue
that angle, see this link: http://www.lebans.com/richtext.htm

Aside from that, you could use multiple text boxes, or labels and text
boxes, with different formatting attributes. The trouble there, of course,
is that you don't know in advance how big the Person text box will need to
be. It is possible to resize and reposition these controls on the fly,
though that's (a) complicated, and (b) only useful in single-form view (not
continuous).
 
S

Swim Dad

Thanks Dirk,

What you described in paragraph 2 (several text boxes with different
formatting) is exactly what I have been doing as a work-around. A small name
like "Ty" will have a lot of space on the left and right, whereas a larger
name like "Supercallafragilistic" will get cut off.
--
Swim Dad


Dirk Goldgar said:
Swim Dad said:
Good Morning,
Thanks in advance for any help.
Using Access 2003 and I am by no means a code wizard.
I have a report that contains a text box. In the text box I would like to
change the color of a concatenated field (i.e. the field name "Person").
Is
this possible?

This is my current statement:

="Total for " & ([Person]) & "= " & Format(Sum([Total_Amount]),"Currency")

Results in: "Total for Smith = $1.00" I would like "Smith" only to be
something different.


You can't do this in a normal text box. You might conceivably do it in a
Rich Textbox, which is not a native Access control. If you want to pursue
that angle, see this link: http://www.lebans.com/richtext.htm

Aside from that, you could use multiple text boxes, or labels and text
boxes, with different formatting attributes. The trouble there, of course,
is that you don't know in advance how big the Person text box will need to
be. It is possible to resize and reposition these controls on the fly,
though that's (a) complicated, and (b) only useful in single-form view (not
continuous).

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)
 
D

Dirk Goldgar

Swim Dad said:
Thanks Dirk,

What you described in paragraph 2 (several text boxes with different
formatting) is exactly what I have been doing as a work-around. A small
name
like "Ty" will have a lot of space on the left and right, whereas a larger
name like "Supercallafragilistic" will get cut off.


If you want to proceed along these lines, see this link:

http://www.lebans.com/textwidth-height.htm
TextHeightWidth.zip is a replacement for the Report object's TextWidth
and TextHeight methods. It is multiline aware and can work in both Report
and Form views. Includes a sample report to show you how to autosize
individual controls with different formatting on the same line to simulate
RTF style text.
 

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