Access 2000.
Main Form: frm_ESKER_ENTRY_TERRI (Standard Form View)
Sub From: frm_ESKER_HISTORY (Opens in Datasheet view)
The main form will bring up an employee based off of their social. Then the subform will list all of the jobs they have ever done. In the subform there is a field called [TestResult]
I added a box and named it [BoxAlert] to my main form. I want to add some VBA that will look at the records in the subform and if any of the records are not "NEGATIVE" in [TestResult] then the box will change colors.
So if employee Steve Willson has 5 jobs & one of the jobs has a [TestResult] of "OPEN" my [BoxAlert] will change from a transparent color to a bright red. This will alert me to look into his history quickly.
Thanks, hope this is clear.
I added this to the main form, but I am getting an error:
Private Sub Form_Current()
Dim Yellow As Long, Gray As Long
Yellow = RGB(250, 250, 210)
Gray = RGB(192, 192, 192)
If Forms![frm_ESKER_HISTORY]![TestResult] = NEGATIVE Then
Me![BoxAlert].BackColor = Yellow
ElseIf Forms![frm_ESKER_HISTORY]![TestResult] = POSITIVE Then
Me![BoxAlert].BackColor = Gray
End If
End Sub
Main Form: frm_ESKER_ENTRY_TERRI (Standard Form View)
Sub From: frm_ESKER_HISTORY (Opens in Datasheet view)
The main form will bring up an employee based off of their social. Then the subform will list all of the jobs they have ever done. In the subform there is a field called [TestResult]
I added a box and named it [BoxAlert] to my main form. I want to add some VBA that will look at the records in the subform and if any of the records are not "NEGATIVE" in [TestResult] then the box will change colors.
So if employee Steve Willson has 5 jobs & one of the jobs has a [TestResult] of "OPEN" my [BoxAlert] will change from a transparent color to a bright red. This will alert me to look into his history quickly.
Thanks, hope this is clear.
I added this to the main form, but I am getting an error:
Private Sub Form_Current()
Dim Yellow As Long, Gray As Long
Yellow = RGB(250, 250, 210)
Gray = RGB(192, 192, 192)
If Forms![frm_ESKER_HISTORY]![TestResult] = NEGATIVE Then
Me![BoxAlert].BackColor = Yellow
ElseIf Forms![frm_ESKER_HISTORY]![TestResult] = POSITIVE Then
Me![BoxAlert].BackColor = Gray
End If
End Sub
Last edited: