Formatting Report Details?

kujeremy

Registered User.
Local time
Today, 04:48
Joined
Oct 16, 2009
Messages
28
Hello - I am stuck with trying to accomplish the following and was hoping for some assistance!

I have a report which I would like to change the text of a field blue if a certain condition is met. What I want to happen on this report is if a specific field has an "Active" - then it will be in Blue text, otherwise it is in black text.

I have gone into the report ->in the Details section -> put a procedure in the On Format event. The code I have been trying is:

-----
If Analysis_Status = Active Then
Me.Analysis_Status.ForeColor = vbBlue
Else
Me.Analysis_Status.ForeColor = vbBlack
End If
End Sub
-----

I'm clearly making a mistake somewhere but am not sure where - thanks for any assistance!
 
Try

If Analysis_Status = "Active" Then

You might find Conditional Formatting easier, though code is also fine.
 
Yes - I've tried it with quotes also and it didn't work.

I also tried 2 and "2" as that is the numerical ID that "Active" has on the table, it did not work either.

Tried conditional formatting also with no luck. Truth be told, I was trying it with code because when the condition was met there are about 10 other fields that I would be switching to red for that result (all of the fields for that one record - to call it out as being active) and was just starting off with getting one field to change colors.
 
CF would still work, as you can apply it to other fields. Can you post the db here? Either 2 or "Active" should work (the ID or the text, depending on what is being returned).
 
Unfortunately I better not upload the DB here - if I did I would probably have my internal security people at my desk within minutes, and I recently had my wrist slapped for downloading screen capture software - to which they've now spent 3 weeks analyzing that PC to see if it was compromised (I told my boss that I think they are very bored over in security)

I'll play around with the CF to see if I can get that to work.

Thanks for checking it out though!
 
Bam! Messing with CF again. I had played with it earlier and used "Active" changed that to 2 and it immediately worked.

Once again, thanks for looking into!
 
Glad you got it working!
 

Users who are viewing this thread

Back
Top Bottom