I have read thru some of the other responses to questions like this one, but have not found anyone having this problem. I have some fields that I wish to be required. I have set the required property to yes in the table. On my form, I have but an On Error event procedure, so that when a user tries to close the form, it triggers and then has some code to determine which fields have been left empty and prints an appropriate message.
Example:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Response = acDataErrContinue
If DataErr = 3314 Then
If IsNull(Name) Then
MsgBox "You must provide a name."
Name.SetFocus
ElseIf IsNull(dob) Then
MsgBox "You must provide a date of birth."
dob.setfocus
end if
end if
Here is the problem. The On Error event only triggers if I
1) try to go to the next or previous record. or
2) use the "x" in the upper right-hand corner to close the form.
If I use my button to go back to the Main Menu, the form simply closes with no message and without saving the record.
I am using Access 2000.
Any ideas?
Melissa
Designing Access databases since 1999
Example:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Response = acDataErrContinue
If DataErr = 3314 Then
If IsNull(Name) Then
MsgBox "You must provide a name."
Name.SetFocus
ElseIf IsNull(dob) Then
MsgBox "You must provide a date of birth."
dob.setfocus
end if
end if
Here is the problem. The On Error event only triggers if I
1) try to go to the next or previous record. or
2) use the "x" in the upper right-hand corner to close the form.
If I use my button to go back to the Main Menu, the form simply closes with no message and without saving the record.
I am using Access 2000.
Any ideas?
Melissa
Designing Access databases since 1999