A
Amit
Windows XP, MS Access 2000
===========================
Hi,
I have a form with default view set to "Continuous Form".
I have 2 textbox controls on the form - Number and
personName. There is only one table, with the following
fields - Number, personName and personStatus. The source
for the form is a query based on this table, and with the
3 fields. I'd like to display the name of the person in a
different color based on the value of the personStatus.
If personStatus = Active, personName.font_color = black
If personStatus = Inactive, personName.font_color = red.
I have the following code:
========================================================
Dim lngRed As Long, lngBlack As Long
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
If Me.personStatus = "Inactive" Then
Me!personName.ForeColor = lngRed
Else
Me!personName.ForeColor = lngBlack
End If
End Sub
=========================================================
in the form's OnCurrent section. It's not quite working.
What it does is it turns the color for ALL the records on
the form to either black or red, depending on the
focus/cursor and the value of personStatus for that
particular record.
Obviously, I need to place this code in a different
section. But, I'm not sure where. Any help or pointers
will be much appreciated.
As a note, the ideal situation would be to have the form
in Datasheet view, and display the names in different
colors. Is that possible? From my internet search, it
seems like an easier proposition to format the form in
Continuous view and have it mimic the Datasheet view, than
to format in Datasheet view.
Thanks!
-Amit
===========================
Hi,
I have a form with default view set to "Continuous Form".
I have 2 textbox controls on the form - Number and
personName. There is only one table, with the following
fields - Number, personName and personStatus. The source
for the form is a query based on this table, and with the
3 fields. I'd like to display the name of the person in a
different color based on the value of the personStatus.
If personStatus = Active, personName.font_color = black
If personStatus = Inactive, personName.font_color = red.
I have the following code:
========================================================
Dim lngRed As Long, lngBlack As Long
lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
If Me.personStatus = "Inactive" Then
Me!personName.ForeColor = lngRed
Else
Me!personName.ForeColor = lngBlack
End If
End Sub
=========================================================
in the form's OnCurrent section. It's not quite working.
What it does is it turns the color for ALL the records on
the form to either black or red, depending on the
focus/cursor and the value of personStatus for that
particular record.
Obviously, I need to place this code in a different
section. But, I'm not sure where. Any help or pointers
will be much appreciated.
As a note, the ideal situation would be to have the form
in Datasheet view, and display the names in different
colors. Is that possible? From my internet search, it
seems like an easier proposition to format the form in
Continuous view and have it mimic the Datasheet view, than
to format in Datasheet view.
Thanks!
-Amit