Compile error on simple command button

Timberwolf

Registered User.
Local time
Today, 06:54
Joined
Dec 15, 2000
Messages
33
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.
 
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.
 
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
 

Users who are viewing this thread

Back
Top Bottom