Rick
I'm liking this code. I tried to use it but it didn't trap one of my fields. Then I noticed that the field was numeric and your code only trapped text. I modified it as follows:
[tt] Dim currctl As Integer, numctls As Integer
Dim ctl As Control
numctls = Screen.ActiveForm.Count
For currctl = 0 To numctls - 1
Set ctl = Me(currctl)
' Check the status of Controls with the Validate Tag
If ctl.Tag = "Validate" Then
If IsNull(ctl)
Or ctl = 0 Then
MsgBox "Please fill in the field(s) highlighted in red and click the CLOSE button again.", vbOKOnly + vbCritical + vbDefaultButton1, "FIELD(S) EMPTY"
ctl.BackColor = 255
ctl.SetFocus
Exit Sub
ElseIf Not IsNull(ctl) Then
ctl.BackColor = Me!BackColor.BackColor 'Set backcolor of control back to original
End If
End If
Next currctl[/tt]
This worked great if the user then clicked the CLOSE button to exit the form. If the user fixed the trapped errors and then tabbed through to a blank input screen to enter a record, the last trapped field remained red!
How do you set BackColor back to white in this instance?
Jim DeGeorge ![[wavey] [wavey] [wavey]](/data/assets/smilies/wavey.gif)