I have a subform displaying in datasheet view. I am checking to see if all the required data is enter before going to another record and if not, a pop up a message appears and the cursor goes to the required field that is not filled out. The problem is that it works on the first go around, but not subsequent go arounds for the same record.
For instance, if the user forgets to enter the name of the client and goes to a new record, the pop up message will appear and go to the "txtName" data entry field of the record they were just entering. However, if the user still does NOT fill out the name (after the initial message) and goes to the next record, no pop up message occurs. Why isn't the BeforeUpdate event triggered the second time around? Is there a different event I should be putting this code?
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ctr As Control
Dim var As String
For Each ctl In Me.Controls
If ctl.Tag = "required" Then
Debug.Print "Required"
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!"
ctl.SetFocus
Exit Sub
End If
End If
Next
End Sub
Access 2007