Hello all,
I have a table with 4 required fields, and a form to add new entries to the table. While testing, if I don't enter a value in one of the required fields, and press the standard 'X' close button at the top right of the form, I get an error message "The field xxxxx.xxxxx cannot contain a Null value because the Required property for this field is set to true. Enter a value in this field".
However, I also have added an 'Exit' button to the form with the following VBA code ;
If I leave one of the required fields empty and press this button the form closes with no error message, and does not update the record.
Can anyone tell me why the database reacts differently to the standard 'X' close button and my button which uses 'docmd.close' ? It's driving me mad.
Thanks,
StepOne
I have a table with 4 required fields, and a form to add new entries to the table. While testing, if I don't enter a value in one of the required fields, and press the standard 'X' close button at the top right of the form, I get an error message "The field xxxxx.xxxxx cannot contain a Null value because the Required property for this field is set to true. Enter a value in this field".
However, I also have added an 'Exit' button to the form with the following VBA code ;
Code:
Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
DoCmd.Close
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Number & " " & Err.Description
Resume Exit_cmdExit_Click
End Sub
If I leave one of the required fields empty and press this button the form closes with no error message, and does not update the record.
Can anyone tell me why the database reacts differently to the standard 'X' close button and my button which uses 'docmd.close' ? It's driving me mad.
Thanks,
StepOne