Function Called from Command Bar Control Executes 3 Times
BUG: Function Called from Command Bar Control Executes 3
If you use a custom menu bar, and call a code routine in the
active form, then the code will run 3 times.
This bug exists in Access97, Access2000, and Access2002.
The suggested solution in the above KB article is to move the
code out of the forms module and into a standard code module.
For example if your open form is called myForm, and you wanted
to call some function code in your forms module, then you should
be able to use the following expression in the "on action" for
your custom menu bar:
The above example would call a function called "DeleteRec". Note
that you MUST declare the function as public in the forms module
for the above to work.
However, the above is NOT workable due to the bug that will call
the code 3 times.
If you remove the forms qualify, then you get:
Using the above expression in your menu bar "on action" to run
the code is shorter, and it also fixes the "3 times" bug.
Donít qualify the forms reference in the menu bar, and your code
will not run 3 times.