NigelShaw
Registered User.
- Local time
- Today, 08:47
- Joined
- Jan 11, 2008
- Messages
- 1,575
Hi,
something probably simple but i cant see it.
i am trying to make a textbox change colour based on a value being present or not. if the textbox has a value, change the box green otherwise, change it pink. here is my code-
this is place on the OnExit of the textbox so in theory, as you exit, the code is run however, if i have text in the textbox, it works. if the textbox is empty, i cant exit from it. i have tried a few other ways of doing this but i end up with the same end result.
this is pretty straight forward right?
thanks,
Nigel
something probably simple but i cant see it.
i am trying to make a textbox change colour based on a value being present or not. if the textbox has a value, change the box green otherwise, change it pink. here is my code-
Code:
Private Sub FirstName_Exit(Cancel As Integer)
Dim strFNVal As String
Dim lngGreen As Long
Dim lngPink As Long
lngGreen = RGB(181, 203, 136)
lngPink = RGB(223, 167, 165)
strFNVal = Nz(Me.FirstName, False)
If strFNVal = False Then
Me.ActiveControl.Properties("BackColor") = lngPink
Else
Me.ActiveControl.Properties("BackColor") = lngGreen
End If
End Sub
this is pretty straight forward right?
thanks,
Nigel
Last edited: