View Full Version : Compile error on simple command button


Timberwolf
03-23-2001, 08:58 AM
I created a simple button on a form that closes the form. I didn't write the code myself, I used the command button wizard. The button worked yesterday, but today, I get an error message:

Compile error:
Ambiguous name detected: Exit_Click

I'm using Access 2000 on Windows NT 4.0.

Any ideas? Thanks.

KevinM
03-23-2001, 03:49 PM
Check that 'Exit_Click' hasn't been duplicated, one after the other in your code. This is easily done by mistake when copying/cutting code in th evb window.

Rich@ITTC
03-23-2001, 03:58 PM
Hi Timberwolf

Looks like you have a duplicate piece of coding. I would be inclined to delete your button AND delete the coding that goes with it (by using View and Coding on the Menu Bar).

Then re-create your Close button using the Wizard, but call it:

cmdClose

This should then give you this code, which should work fine.

------------------------------------------
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click

DoCmd.Close

Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
MsgBox Error$
Resume Exit_cmdClose_Click

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

HTH


Rich Gorvin

Timberwolf
03-26-2001, 07:20 AM
Thanks, guys!