Custom Menu A2000

S

Sam D

Thanks for your thoughts!

I have a form with a custom menu - each menu item executes a function. The
form also includes command buttons which mirror the custom menu's items
(much like a toolbar). Each command button's click event runs the identical
function to the corresponding menu item.

Now the command buttons work as expected, however each of the menu items
execute their function 3 times.

I cannot even imagine why this is occurring.

Any ideas???

Sam
 
A

Albert D. Kallal

It is a long standing known bug....

=([forms]![myForm].DeleteRec())

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:

=DeleteRec()

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.

You can up on this here

http://www.mvps.org/access/bugs/bugs0048.htm
 
S

Sam D

Fantastic, I was starting to pull my hair out on this one!!! Thanks Albert.

I use custom menus often. Have just examined some of my other applications
and have found this problem in operational systems - doesn't say much for my
testing. Fortunately I generally write the functions within modules.

One other point for future readers...

=DeleteRec does NOT solve the problem, whilst

=DeleteRec() DOES solve the problem

Sam
 
Top