Backcolor in text field for each record

mulderm

Registered User.
Local time
Today, 20:06
Joined
Jul 3, 2004
Messages
13
Hello,

I have the following code for changing the back-color of a field:

Private Sub txttekst1_AfterUpdate()

Dim lngRed As Long
Dim lngGreen As Long

lngGreen = RGB(0, 255, 0)
lngRed = RGB(255, 0, 0)

If Me.txttekst1 < 100 Then
Me.txttekst1.BackColor = lngRed
ElseIf Me.txttekst1 > 200 Then
Me.txttekst1.BackColor = lngGreen
End If

End Sub

Problem: When I change to record to record the back color is not
the same as I have write the code.

mulderm
 
Try placing the code in the on current event of the form too.

(there's also some constants, I think, that can be used for colours. vbRed, vbGreen)

Or try conditional formatting from the format menu (2000+ versions)
 
The code belongs in the form current event, in your after update event just put
Call Form_Current
 
~ Deleted ~
edit:just beat me to it Roy & Rich, you boys are fast on that mouse. :)
 
Last edited:

Users who are viewing this thread

Back
Top Bottom