By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,079 Members | 880 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,079 IT Pros & Developers. It's quick & easy.

Access Conditional Formatting Help

P: 2
Access 2003
VB 6.5

I'm attempted to run conditional formatting on a date field based on the value in another field. I've steped through this code and it is recognizing the values correct and is even executing the code to set the back ground color. However when run the report I don't get any formatting.

Any help would be appreciated!

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

On Error GoTo Detail_Format_Error

Select Case [Reports]![pm_original_scorecard_report]![def_doc_health_cd].Value
Case Is = "YL"
[Reports]![pm_original_scorecard_report]![def_doc_act_cmplt_dt].BackColor = vbYellow
Case Is = "GN"
[Reports]![pm_original_scorecard_report]![def_doc_act_cmplt_dt].BackColor = vbGreen
Case Is = "BL"
[Reports]![pm_original_scorecard_report]![def_doc_act_cmplt_dt].BackColor = vbBlue
Case Is = "RD"
[Reports]![pm_original_scorecard_report]![def_doc_act_cmplt_dt].BackColor = vbRed
Case Else
[Reports]![pm_original_scorecard_report]![def_doc_act_cmplt_dt].BackColor = vbWhite
End Select

Exit Sub

MsgBox "Error " & Err.Number & ": " & Err.Description
Resume Detail_Format_Exit

End Sub
Oct 17 '08 #1
Share this Question
Share on Google+
3 Replies

Expert 5K+
P: 8,675
If you are getting the Back Colors, what exactly aren't you getting?
Oct 17 '08 #2

P: 2
I wasn't getting the back colors even though I stepped through the code and it showed it executing that line.

However, we can chalk this up to a strange MicroSoft behavior because I just went in and tried the conditional formatting through the GUI. I literally just added one condition and ran the report and everything started working. I then went and removed the conditional formatting via the GUI and just kept the code ... Still works. I didn't change one piece of code ......
Oct 17 '08 #3

Expert 2.5K+
P: 3,532
I've never had trouble using CF thru code, but when using expressions I knew were valid in CF thru the GUI I've had a number of times when it didn't work. Once I gave up to tend to other business, and returning to the form found that it worked just as it should! Since then when this happens I always close the app then re-open it and it always works. The CF appears to "hang." I've noticed that this tends to occur more frequently when I've been experimenting with different CFs on a single textbox. It'll work the first couple of tries and then bomb.

Welcome to Bytes!

Linq ;0)>
Oct 17 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.