The code below actually works well except when the user uses the mouse (instead of the tab) to move from textbox to textbox (it is in datasheet view) and accidentally clicks outside a field (like the field header or on the edge of the field - which seems to happen a lot for one of my users). In this case the message box below pops up before they are actually finished entering the record. Any suggestions as to how I can accomplish the same data validation process without using form_before update? I thought about adding an "Add record" button but didn't like the way it worked (process wise-not coding wise) on my datasheet view (which is how I want my entry form to look).
I had the fleeting thought of trying to disable the mouse functionality but knew that would not go over well.
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ctl As Control
Dim var As String
For Each ctl In Me.Controls
If ctl.Tag = "required" Then
var = ctl.ControlTipText
If ctl = "" Or IsNull(ctl) Then
MsgBox "You've have not checked all the required steps for this record. Please see the following " + var, 48, "More Info Required!"
Cancel = True
ctl.SetFocus
Exit Sub
End If
End If
Next
End Sub