Making an Access 2010 field mandatory

Sanjo

Registered User.
Local time
Today, 17:14
Joined
Mar 14, 2012
Messages
62
I have inserted code into the BeforeUpdate event that tells a user if a particular field, which has been skipped, is required. The code works fine, but when you click the "OK" button so that you can proceed to input the required field, you get (1)a window that tells you "You can't save this record at this time.....do you want to close the db object anyway?" You click "no" so you can proceed and you get (2)another window titled "Macro Single Step" . I then have to "X" out of that window before finally being able to input the required field.

Is there any way I can prevent (1) and (2) from displaying so that the user can simply go from "OK" back to the input screen and enter the required field?

thanks for any help.
 
I am using the following code:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me![Niche]) Then
MsgBox "Niche Number is required."
Cancel = True
End If
End Sub

thanks for your help.
 
And you still get the errors? Are you clicking on a "Close" button or the red "X"?
 
Can you post the db here?
 
can't get the copy tool to work here, but it is as follows:

niche / space "A" / space "b"/ first name / middle name / last name
 
I can send a design layout of the db to an email address.
 

Users who are viewing this thread

Back
Top Bottom