Regarding a post on Required field in table-

Christine5017

Registered User.
Local time
Today, 21:21
Joined
Mar 7, 2002
Messages
10
I found a post on required fields in a table that was posted and answered on 4-4-02. My problem is that I tried it and it does not keep the form open.
If IsNull(Me![Text20])Then MsgBox("You must fill out SS Number")
Cancel=True
Else
DoCmd.Close

I recieve an error on the Cancel part.
If I take out the Cancel it works but closes the form.
Is there something that I am missing, I would like for the form to stay open after the message appears.
Thank you
 
I would assume that you do not have your code in an event that allows the use of cancel. You would need to put your code in the Before Update event to use cancel to cancel the update event... Try this code then...

If IsNull(Me![Text20])Then
MsgBox("You must fill out SS Number")
Exit Sub
Else
DoCmd.Close
End If
 
Thank you so very much--what you wrote works great--Thank again
smile.gif
 

Users who are viewing this thread

Back
Top Bottom