Forecolor not working in a form

A

Amit

MS Access 2K, Windows XP
========================
Hi,

In my form, I'd like to change the color of the textbox
control based on a condition. I have the following code in
the "On Current" event of the form:
=====================================================
Private Sub Form_Current()
'change the color of the person to Red if Inactive
Dim lngRed As Long, lngBlack As Long
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)

If Me.StaffStatus = "Inactive" Then
Me!PersonName.ForeColor = lngRed
Else
Me!PersonName.ForeColor = lngBlack
End If
End Sub
=======================================================
This code works (turns the text to Red where applicable)
when I view the form in the "Form view", but doesn't work
when I view it in "Datasheet view".

Is there any way to make this work?

Thanks!

-Amit
 

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