change color of text based on user's response

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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.
 
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.
 
Back
Top