Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Color a report field 1

Status
Not open for further replies.

molly

Technical User
Jul 17, 2000
219
US
Is there a way to have report field us a certain color for a certain answer?

I have a report field named "Visit Name". I has 2 possible answers. The visitID is either 5 or 100.

I would like the visit names that have a visitID of 100 to show as RED in the report visitID column. I would leave visitID of 5 to be black in the same report column.

Is this possible? thanks,Molly

 
Have a look at Conditional Formatting.
 
Do you mean something like the following on the report fields Coontrol Source line:

=IIf([VisitName]="Follow-up","Blue","Black")

Am I getting closer? I used the color names to show you what i am aiming for. I bet there is a necessary method to get a color. Maybe a number? Any answer except Follow-UP would stay black.

I get #error with the command at the top. So I could use help. I looked at the past conditional formatting messages.
Suggestions?
Thanks. molly
 
I found a source that describes conditional formatting. I did not realize that when i right click on the report field in design mode, there is a conditional formatting choice.

I will now study it and get back to you.

Molly
 
I decided to go with the coding method for this one.
Thanks for leading me to the 2 choices.

I went into the report design, right clicked in the detail report section and made a ON Format build as:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.VisitID.Value = "100" Then
VisitName.ForeColor = vbRed
Else
VisitName.ForeColor = vbBlack
End If
End Sub

Molly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top