When clicking any command button

S

Sue-Fong

Why when clicking any command button, it tells me that "The expression On
Click you entered as the event property setting produced the following
error: Ambiguous name detected: AddCommand_Click"?
 
W

Wayne Morgan

Open the code window (Alt+F11) and do a search (Ctrl+F) on AddCommand_Click.
Make the search parameters the entire project. Do you have more than one
AddCommand_Click in a single module or one in one module with one declared
as Public in another module?
 
J

Jeff Conrad

This occurs when there are two or more procedures/functions with the same name. Access is telling
you, "Oh great, now I'm all confused!" Most often this happens when you add a command button with
some code, decide to delete the button later on, and then add another command button with the same
name.

When you delete a form object in Design View, Access does not clean up after itself by removing the
code associated with the object as well. It is the Access equivalent of "leaving the seat up."

Open the code window behind the form and look for two or more procedures with the same name for that
command button. You will need to manually delete the unneeded code lines. Then all should be well in
the universe and all the form objects can live in peace and harmony.
 
Top