Command Button

  • Thread starter Thread starter Maria Kuhn
  • Start date Start date
M

Maria Kuhn

Guest
I have created a form to which I want to add a "Find Record" command button. I have used the wizard to create a command button many times, this time it is not working. The error msg that I get is as follows:

The expression On Click you entered as the event property setting produce the following error: Ambiguous name detected: Close_Form_Click
The expression may not result in the name of a macro, the name of a user defined function, or [Event Procedure]
There may have been an error in evaluating the function, event or macro.

Of course using the wizard I am not creating the event procedure - I have no idea what is happening ! ! !
Can anyone help ? ?
 
Hi Maria

It sounds like you have two Sub Procedures using the same name - so when you click the Command button Access doesn't know which to run (and it could even be that the Sub Procedure is a different one to the one you are trying to run). I would hazard a guess that you might have created another command button called Close_Form and then deleted the button but not the coding that runs behind the form.

You will need to go into Design View for the form and select View - Code on the Menu Bar.
The module window will open and you will need to scroll down and find out whether you have two sets of Private Subs that will look something like this:

-------------------------------
Private Sub Close_Form_Click()
On Error GoTo Err_Close_Form_Click

DoCmd.Close

Exit_Close_Form_Click:
Exit Sub

Err_Close_Form_Click:
MsgBox Error$
Resume Exit_Close_Form_Click

End Sub
--------------------------------------

If you have two of these, one will have to be deleted.

HTH

Rich Gorvin
 
Rich - Thanks for the info - it really had me baffled! ! Working like a charm now. It looks as if any command buttons I created after the initial one, the coding was added to the coding from the first button and that was the coding the system was using for each new button.
Thanks again,
Maria
 

Users who are viewing this thread

Back
Top Bottom