using the "cancel" feature....

B

Brad Pears

I have a situation where I want to use the cancel functionality. I have code
in a "before update" for a field on my form. A parameter associated with
this event is (cancel as integer).

How do I implement this cancel fucntionality? I have code in this event
that I want to skip if cancelled. How do I accomplish this? Do I simply set
cancel to 0 or 1?

Thanks,

Brad
 
A

Allen Browne

Set the Cancel argument to True if you want to stop the update.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.SomeField) Then
Cancel = True
MsgBox "You forgot to enter SomeField."
Else
'do your other stuff here.
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top