Conditional Formatting More Than 3

sross81

Registered User.
Local time
Today, 13:41
Joined
Oct 22, 2008
Messages
97
I have 5 different possibilities and I wont to change the color the header depending on what the different facility names are. I have tried multiple examples in the group header format event, but it always says it can't find the field named facility although that is what the field is called and if I type me.facility it pops up so there must be something missing. Any ideas for have 5 different conditional formats in a group header?


Select Case Me![Facility]
Case AAA
Me![Facility_Code].ForeColor = vbBlue
Case BBB
'Me![txtPostalCode].ForeColor = vbGreen

'etc for all of them
End Select
 
1. What version of Access are you using?

2. If you can use Conditional Formatting, that is better, but if you aren't on Access 2010 then I can see where you would need code.

3. You would need to put the code in the ON FORMAT event of the section where the control is located. Also, make sure that the CONTROL NAME of the control bound to the Facility field is NOT named Facility and if it is change that control's name to txtFacility and then use:

Select Case Me.Facility
 
I have 5 different possibilities and I wont to change the color the header depending on what the different facility names are.

Me![Facility_Code].ForeColor = vbBlue
I thought you said you want to change the BackColor of the header section but your code doesn't relfect this. Unless your header is called Facility_Code (which I doubt).

If it's the Header section you're changing then you don't need Conditional Formatting. Follow what Bob has recommended in point 3. Also your CASE statement is incorrect. This Case AAA is supposed to be this Case "AAA".
 

Users who are viewing this thread

Back
Top Bottom