Multiple Conditional formatting

G

Guest

Hi there and thank you for taking the time to read my request for help. I
have a continous form in Access 2000 which I would like to apply more than 4
conditional fomats to based on the value of a field called Flag. The values
of FLAG are 1 to 6. I would like help to make each field on the row change
backround colour as follows:
1 = Red
2 = Green
3 = Blue
4 = Default
5 = Amber
6 = Yellow

The fields on the row are Part No, Part Desc, Date, Quantity.

I have tried conditional formatting but that only gives me a maximum of 4
variations so I presume I need to do the above with coding based on an after
update event for each field?

Can anyone help me with this please and maybe give me an example of such code.
 
R

Ron2006

put a select - case statement in the On-Current event of the form to
adjust the background color property of the fields you want changed.

Ron
 
G

Guest

Thank you Ron your your very quick response but I am a bit inexperienced in
the coding department. How would I go about this and what would I write?
 
R

Ron2006

Here is an example of code used to change the bold and font colors on a

form that lists the weeks of a month and highlights the one for the
current control week.


Select Case WeekNumber
Case 1
Me.WhichW1Start.FontBold = True
Me.WhichW1Start.BackColor = 16711680
Me.WhichW1Start.ForeColor = 16777215
Me.WhichW1End.FontBold = True
Me.WhichW1End.BackColor = 16711680
Me.WhichW1End.ForeColor = 16777215
Me.Command35.SetFocus
Case 2
Me.WhichW2Start.FontBold = True
Me.WhichW2Start.BackColor = 16711680
Me.WhichW2Start.ForeColor = 16777215
Me.WhichW2End.FontBold = True
Me.WhichW2End.BackColor = 16711680
Me.WhichW2End.ForeColor = 16777215
Me.Command36.SetFocus
End Select

It is executed in the OnCurrent event. Caption and anything else that
you see in the format tab for a field are accessible and addressable.


This form was not bound so did not progress through records. If you
have one that does go through records AND the captions, etc can change
then you have to code all possibities. The default condition will only
exist on the open , from then on you have to assign the default
captions, etc yourself.

I derived the numbers by using the wizard to change the colors and
looked at the format tab after to see what number was assigned for each
of the colors as I chose them.
 
G

Guest

Thank you again Ron for all your help. I will give this a try in conjunction
with Microsoft help on the Select Case statements.

Cheers and have a great day.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top