Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Aborting an update

Status
Not open for further replies.

Dmcniell

IS-IT--Management
Nov 3, 2003
8
US
Hello and thanks in advance for your help.

I'm trying to do some data validation in the BefureUpdate event of a form, and when I encounter an error, I want to abort the update, show a message box, and return the user to the form.

How do I abort the update within that event?
 
here's an example of what you might do:
[tt]
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Nz(cboCourse.Value, "") = "" Then
MsgBox "Missing Information: Please select a specific course from the list provided.", vbExclamation
cboCourse.SetFocus
Cancel = True
Exit Sub
End If
End Sub
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top