Stopping a procedure to trigger another procedure

  • Thread starter Thread starter Bakema
  • Start date Start date
B

Bakema

Hi there,

In many of my forms I use form-activate and form-current
events to set form parameters on opening or record
change. In a few cases I would like to by-pass this,
especially when the form is opened by an event or command
button on another form. Is there VBA syntax to stop a
procedure automatically triggering another event, like
form-current or form-activate.

Bakema
 
Bakema said:
Hi there,

In many of my forms I use form-activate and form-current
events to set form parameters on opening or record
change. In a few cases I would like to by-pass this,
especially when the form is opened by an event or command
button on another form. Is there VBA syntax to stop a
procedure automatically triggering another event, like
form-current or form-activate.

Bakema

You could create a global variable and set it to True any time you want to skip
the code that would ordinarily run. Then add a line at the beginning of those
procedures to test the value of the variable before executing. Always set the
variable to False at the end of these procedures so that you don't have to
modify code where you want the procedure to execute.
 
HSalim said:
I would use the OpenArgs method rather than a global variable -
You are already using the DoCmd.OpenForm method.
Pass an opening argument such as "Disable" to disable checking.

If the circumstances where procedures are to be bypassed were always triggered by
opening the form, then I would agree The OP suggested that this might not always be
the case.
 
Back
Top