Confirmation message when empty fields are submitted?

RSW

Registered User.
Local time
Today, 05:44
Joined
May 9, 2006
Messages
178
Hello,

I have prepared a form similar to this:

DATE:
PART NUMBER:
SERIAL NUMBER:

DATE and PART NUMBER should be mandatory for each record.
SERIAL NUMBER is optional, BUT I would like to have a confirmation box pop up if the record is submitted without a serial number...something like "No serial numbers specified. Continue?"

Does anyone know of an example of VBA code for something like this? I know how to use Dirty, BeforeDelConfirm etc., but something like this isn't shown in the Access help screen. I'm sure it's pretty simple, but I'm still a novice at this.

Thanks in advance!
 
In the FORM'S BEFORE UPDATE event put:
Code:
If IsNull(Me.YourSerialNumberTextBoxNameHere) OR Me.YourSerialNumberTextBoxNameHere = "" Then
   If MsgBox("No serial numbers specified.  Continue?") = vbNo Then
      Cancel = True
      Me.YourSerialNumberTextBox.SetFocus
   End If
End If

That will cancel the update if no serial number is entered and if they click no. If they click yes, it will just continue as normal.
 
Thank you, Bob!!
 

Users who are viewing this thread

Back
Top Bottom