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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can individual record fields on report be a different color?

Status
Not open for further replies.

hazelett

Programmer
Jun 29, 2001
15
US
I have a report (in Access 97) that needs to print the name in blue if the Last Name is "Smith" and I can do that. However when I also try to get "Jones" to print in blue the "Smith" record goes back to black. Its either every name is in blue or one in blue. I can't find a way to target selected names to be blue.

I'm using this in the detail format event of the report

If me![Last Name] = "Smith" then
me![Last Name].ForeColor = 16711680
Else
Me![Last Name].ForeColor = 0
End If

If me![Last Name] = "Jones" then
me![Last Name].ForeColor = 16711680
Else
Me![Last Name].ForeColor = 0
End If

Work OK for one name. When I repeat the code for Jones then it only work for Jones. It seems to only work for the last code segment. If I don't set the color back to 0 then every last name is blue.

Any suggestions would be much appreciated.
 
You can condense the above example thus:
Code:
[COLOR=blue]Select Case[/color] Me![Last Name]
    [COLOR=blue]Case[/color] "Smith", "Jones"
        Me![Last Name].ForeColor = 16711680
    [COLOR=blue]Case Else[/color]
        Me![Last Name].ForeColor = 0
[COLOR=blue]End Select[/color]
 
Thank you very much. That did the trick. When I first saw your code I thought it would just do the same thing but I was wrong and you are right. I do appreciate the help.

Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top