Public Function fHighlightRequiredControls()
On Error GoTo Err_Handler
'From https://www.access-diva.com/vba23.html
Dim ctl As Control
Dim frm As Form
Set frm = Screen.ActiveForm
For Each ctl In frm.Controls
If ctl.Tag <> "" Then
If ctl.Enabled Then
If InStr(1, ctl.Tag, "require") Then
If Nz(ctl, "") = "" Then
Select Case ctl.ControlType
Case acTextBox
ctl.BackColor = RGB(254, 242, 154) 'Yellow
Case acComboBox
ctl.BackColor = RGB(254, 242, 154) 'Yellow
Case acListBox
ctl.BackColor = RGB(254, 242, 154) 'Yellow
End Select
End If
End If
End If
End If
Next
fHighlightRequiredControls = True
Exit_Handler:
Set ctl = Nothing
Exit Function
Err_Handler:
MsgBox "Error " & Err.Number & ": " & Err.Description, vbExclamation, "fHighlightRequiredControls()"
Resume Exit_Handler
End Function