Unanswered: Conditional Fomatting (more than 3 conditions) in Access Report?
Ok... i just keep staring at the VBA window thinking it's all going to be clear how i do this... but for some strange reason, it's not coming to me....
I know i need select case, but i can't figure out how to use it in this instance....
the background... i have a payments report that has "blocks" of payment information in columns....
so, what i would like is for each record (row), that depending on the status of the payment, it makes the 3 fields a certain color.... so, for john smith, his 1st payment is marked as paid, so txtPayment1Amt, txtPayment1Date, & txtPayment1Status would have a background color of green, while his 2nd payment is marked as NSF so txtPayment2Amt, txtPayment2Date, & txtPayment2Status would have a background color of red... and so on for the status of payment 3.... there are actually 6 different statuses that have conditional formatting...
hmmm... well even programming it with a very cumbersome non-select case methodology seems to make it not work per row... meaning if just one of the rows says "Paid" it makes all of them paid... here is my code... any thoughts on what i messed up?
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.txtPayment1Status = "Paid" Then
Me.txtPayment1Date.BackColor = RGB(50, 205, 50)
Me.txtPayment1Status.BackColor = RGB(50, 205, 50)
Me.txtPayment1Amt.BackColor = RGB(50, 205, 50)
Understandable. Set a breakpoint at the beginning of the code so you can step through it and maybe you'll see where the code is going wrong. Are you sure the status field contains text and not an ID value?
harumph... well i don't understand why, but it appears if i do the elseif statement for EVERY value that might appear in the field, it works... i always thought that it would do nothing if you didn't specify criteria that was met... but i guess you have to spell out what to do for every iteration... weird. Thanks for your help!
Not necessarily, but you can add an Else to do what you want if none of the specified conditions are met. As it is, it wouldn't change what was previously set, so that's likely why they're all the same.