Formatting Form Colour using VBA

deere8585

Registered User.
Local time
Today, 20:52
Joined
Jun 26, 2008
Messages
27
I have a form (single view as opposed to continous) that has the on current event built into the form detail properties

Private Sub Form_Current()
If Me.Status = 1 Then
Me.Detail.BackColor = vbGreen
Me.Form.AllowAdditions = False
Me.Form.AllowEdits = False
Else
If Me.Text20 > Me.RequestedBy Then
Me.Detail.BackColor = vbRed
Else
Me.Detail.BackColor = vbYellow
End If
End If
End Sub

This locks the form and has a green background if the record is completed, if the current system date (me.text20) is greater than the action requested by date then the form has a red background otherwise a yellow background is shown.
The vbred/green/yellow are quite harsh on the eyes to look at so I would like some more flexibility on the colours used as the form back colour-however when I exchanged vbgreen for vb2322503 (a shade of green I liked in the define customer colour tool) then the form background is simply black this appears to happen whatever customer colour 'number' I enter.
If any one would be so kind as to point out where I'm going wrong here I would be most grateful!
 
The vb prefix indicate a VBA constant. You need to simply use the number 2322503 without the vb prefix.
 
That works a treat thank you very much!
 

Users who are viewing this thread

Back
Top Bottom