What is the purpose of Cancel as Integer? (1 Viewer)

Axis

Registered User.
Local time
Today, 10:40
Joined
Feb 3, 2000
Messages
74
I haven't been able to find the answer to this elsehwere, and I know someone here will have the answer: What function does (Cancel as Integer) serve in code and why does it appear only on some subs and not other?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:40
Joined
Feb 19, 2002
Messages
43,515
The Cancel variable gives you an opportunity to tell Access to cancel the current event.

The place where I use this most often is the BeforeUpdate event of a form. The BeforeUpdate event is the last event executed before Access actually saves the current record. This gives you one last chance to edit the data entered on the form. If a problem is found - display a message box that describes the problem and follow it with:
Cancel = True
This tells Access to cancel the update event and not save the record.
 

Users who are viewing this thread

Top Bottom