By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,863 Members | 879 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,863 IT Pros & Developers. It's quick & easy.

Menu Button Error Woes

P: n/a
Access has me flummoxed again (nothing new in that). I added menu buttons to
a form using the command button wizard on the tool bar. They worked fine.
You can see the "onclick" event under "Dipslide Add Record" below.

Then when I went to a second form, accessing a different table, and tried to
add the same button all I got was an error message to the screen. I did
exactly the same thing, used the command button on the tool bar, for exactly
the same purpose for the button but the onclick event is shown below under
"Inventory Add Record." I have gone in and out of the programme, reset the
button but still get the same error to the screen when I click on it.

The error reads: "The expression On Click you entered as the event property
setting produced the following error: Ambiguous name detected:
SaveInventoryRecord_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 evaluating the function, event or macro.)

Help would be appreciated. Thank you.

*******************************
Dipslide Add Record:
*******************************
(Button name "New Record Button.")

Private Sub NewRecordButton_Click()
On Error GoTo Err_NewRecordButton_Click
DoCmd.GoToRecord , , acNewRec

Exit_NewRecordButton_Click:
Exit Sub

Err_NewRecordButton_Click:
MsgBox Err.Description
Resume Exit_NewRecordButton_Click

End Sub

********************************
Inventory Add Record:
********************************
(Button name "Add Record.")

Err_Command219_Click:
MsgBox Err.Description
Resume Exit_Command219_Click

End Sub
Private Sub AddRecord_Click()
On Error GoTo Err_AddRecord_Click
DoCmd.GoToRecord , , acNewRec

Exit_AddRecord_Click:
Exit Sub

Err_AddRecord_Click:
MsgBox Err.Description
Resume Exit_AddRecord_Click

End Sub
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
William, I too have spent a lot of time trying to debug a similar
problem before finding a fix. In the newsgroups you will find people
saying that the answer is that there are two events defined with the
same name; and that if you go into your code section and look for it,
you will find it. This is not true in all cases. This error can also
be caused by a confusing form property. If you look at your form
properties, you will find a property called "has module." In some
cases – while creating events for controls using the [event tab] –
access will ask you to enable the "has module" property by changing it
to ‘Yes.' If you go and do this, occasionally Access gets confused
and creates another code module for the form that you cannot see. I
have not found any way to get to the other module. Because the other
module contains duplicate ‘event declarations,' Access cannot
determine which routine you are referring to. You will have to change
this value to ‘No' and then allow the changes to be saved. Next, one
of two things will happen. You will have to close the database and
then re-load it. After this, the "has module" property will be
automatically set back to ‘Yes,' or you have to set it back manually.
This should get rid of the hidden ‘code module.' This has worked for
me several times, so I thought I'd better post it.
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.