Conditional Formatting

Sykesjas

Registered User.
Local time
Today, 14:44
Joined
Jun 14, 2010
Messages
10
Hi,

Was wondering if someone could help me

If written a conditional format code on VB for a form. The code is 'Select Case' which changes the colour of a rectangle (Box17) depending what is in Field1.

However the problem I'm having is that when I click on a record all the rectangle's change, rather than being specifc to that particular record. For example I would like each record to have a different colour rather than them be all the same.

The picture attached shows the problem I'm having. Level 1 field is green, However level 2 field isnt Red unless I click on it, but then all the rectangles change to red.

Private Sub Form_Current()
Select Case Field1
Case "Level 1"
Box17.Properties("Backcolor") = vbGreen
Case "Level 2"
Box17.Properties("Backcolor") = vbRed
Case "Level 3"
Box17.Properties("Backcolor") = vbYellow
Case "Level 4"
Box17.Properties("Backcolor") = vbBlack
Case Else
Box17.Properties("Backcolor") = vbBlue
End Select

End Sub

Hope this makes sense!
 

Attachments

  • New Picture (1).jpg
    New Picture (1).jpg
    55.9 KB · Views: 148
This only works with single view form and not continious forms, but if you use Conditional Formating you can get this to work.

JR
 
I need to use more than 3 colours. So I guess I can't acheive this?

Would it be possible to do this in a report?
 
Take a look at this link it may help you get what you want.
 
Hi Dcrake,

Yes that is exactly what I want to achieve! Where is the code you have used on yours?

Thanks
 
There is no code required. If you deconstruct the form you will see there is a ole field containing a coloured bitmap set as the background and it changes according to the value selected.
 
Thans very much for your help, managed to get it solved :)
 

Users who are viewing this thread

Back
Top Bottom