I am trying to highlight fields on a form that the user is required to fill in. The code works on the OnOpen event and if I put it behind a button control. However, no matter where I put the code it will not auto update after the user moves through each field on the form. What am I missing here? I thought that every time the user changes or enters a value in one of the fields on the report, that would be able to trigger a beforeupdate or afterupdate event. Not the case. If the field is highlighted yellow and the user enters a value and then leaves the field it still stays yellow. I am trying to avoid having to put the below code behind every one of the 15 required fields on this form. Thanks for the help.
I have tried the BeforeUpdate, AfterUpdate, and OnDirty events.
Code:
Dim ctl As Control
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
If ctl.Tag = "Required" And IsNull(ctl) Or ctl = "" Then
ctl.BackColor = vbYellow
Else
ctl.BackColor = vbWhite
End If
End Select
Next ctl