G
Guest
I was looking in on answer a question without you guys help, SHAME ON ME!!!
I discovered the bug where, using the close button DoCmd.Close, does not save
if required fields are left empty.
I found an answer in the forum that led me to Microsoft's site. Microsoft
says to use this code to check if one of your required fields is empty.
If IsNull(Me![Field1]) Then
If MsgBox("'Field1' must contain a value." & Chr(13) & Chr(10) & _
"Press 'OK' to return and enter a value." & Chr(13) & Chr(10) & _
"Press 'Cancel' to abort the record.", _
vbOKCancel, "A Required field is Null") = vbCancel Then
DoCmd.Close
Else
Me![Field1].SetFocus
End If
Else
DoCmd.Close
End If
My problem is I have more than one required field on the form and cannot
figure out how to make this code check them all. The fields are Teacher,
Period, Student, and Reason. How can I edit this code to check them all to
see if they are filled in and give me a personal message box for each.
Your guys are life savers.
I discovered the bug where, using the close button DoCmd.Close, does not save
if required fields are left empty.
I found an answer in the forum that led me to Microsoft's site. Microsoft
says to use this code to check if one of your required fields is empty.
If IsNull(Me![Field1]) Then
If MsgBox("'Field1' must contain a value." & Chr(13) & Chr(10) & _
"Press 'OK' to return and enter a value." & Chr(13) & Chr(10) & _
"Press 'Cancel' to abort the record.", _
vbOKCancel, "A Required field is Null") = vbCancel Then
DoCmd.Close
Else
Me![Field1].SetFocus
End If
Else
DoCmd.Close
End If
My problem is I have more than one required field on the form and cannot
figure out how to make this code check them all. The fields are Teacher,
Period, Student, and Reason. How can I edit this code to check them all to
see if they are filled in and give me a personal message box for each.
Your guys are life savers.