I am trying to check there are no null values in Sub Form (Using Forename)...I have tried the code below and it is not working, any help would be greatly appreciated. I have a Pupil Table with a separate table for contacts (subForm) and added this code to a 'Save' command button
UG added code Tags
UG added code Tags
Code:
Private Sub cmdSave_Click()
'Ensure a Name has been selected
If Me.frmPupilContact_subform.Forename Is Null Then
MsgBox "You must enter a name", vbOKOnly
Else
'Otherwise save
DoCmd.Save
MsgBox "The registration has been saved", vbOKOnly
'Close and open the form to clear it
DoCmd.Close
DoCmd.OpenForm ""
End If
End Sub
Last edited by a moderator: