change color of text based on user's response

R

RatherBeeHome

I have a report linked to one query. At the start of the report, I want to
ask user's input, which will generate the title of the report. After the
user enters information into the prompt box, I want to base the color of the
Title, based on what was inputted. How can I achieve this?
 
F

fredg

I have a report linked to one query. At the start of the report, I want to
ask user's input, which will generate the title of the report. After the
user enters information into the prompt box, I want to base the color of the
Title, based on what was inputted. How can I achieve this?

Add an unbound text control to the report header.
Set it's Control source to something like:
="This is my " & [Enter text]

Code the Report Header Format event:

If [ControlName] = "This is my school" Then
[ControlName].BackColor = vbRed
[ControlName].ForeColor = vbYellow
Else
[ControlName].BackColor = vbWhite
[ControlName].ForeColor = vbBlack
End If

You will be prompted to enter the text.
If the word entered is 'school', the color of the control colors will
be Yellow on Red. If any other word is entered the control colors will
be black on white.
Adjust the text and colors according to your needs.
 
G

gumby

Use the conditional Formating option under format in the design view of
the report. Highligth the field you want to conditionally format before
going to Format-Conditional Formating control.
 

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