Command Button

  • Thread starter Thread starter EJohnson
  • Start date Start date
E

EJohnson

Guest
I created a command button on my form to Add Record. When I clicked on it there was an error msg : Ambiguous name detected: Add_Record_Click. The expression may not result in the name of a marco the name of a user defined function or [Event Procedure]. I tried recreating it and it always has the same error msg. Thanks for any help.
 
Create the button using the Wizard. In the last screen use whatever name that Access has given the button. See if that clears up your problem...
 
The reason for the error is that sometimes when you delete a control that has an event procedure written in code, Access just deletes the control and leaves the code. My guess is that you have made a control with a wizard and assigned it a name like "cmdOpen". Then you deleted the button. Then you added the button again. Well, because you never erased the old code, you now two sets of code for the same event procedure for the same control.

Solution: Click the control and go to the onclick eventprocedure. Then click the three dots to go to code mode. Then scroll though the code looking for two subroutines with the same name (the one you're trying to use) then delete the code for one of these. Then it will work.
 
perfect solution
I had the same problem ..
and same error messge
I had Deleted a previous command
which means I had code in twice

mucho gratzi
 

Users who are viewing this thread

Back
Top Bottom