Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My buttons dont work!!??

Status
Not open for further replies.

mattpearcey

Technical User
Mar 7, 2001
302
GB
With my main form, i have placed a series of command buttons, i.e. search, navigator, open form, save, delete, etc, in the footer area. They have been working fine, up until now. As the database as developed, the buttons are now not working and the follwing error message comes up. "The expression On Click you entered as the event property setting produced the following errod:Ambiguous name detected: Open_comments_form_Click. *The expression may not result in the name of the macro, the name of the user-deined function or [Event Procedure] *There may have been an error evaluating the function, event, or macro.

Any ideas on how to rectify? Tried deleting the action buttons and then putting them in again, but same error comes up again. Its in 97 version.

Much appreciate all the help.

Kind regards

Matt
 
When working on your form in design view hold the "ALT" key and hit F11 to open the Visual Basic Environment. Go to the debug option on the menu bar and choose compile (compile loaded modules in 97). I suspect you have duplicated some of the "subs" here and you will have to sort through them discarding the duplicate(s)and making sure the remaining subs are connected to your command buttons. Gord
ghubbell@total.net
 
Sorry Matt: If you're working in 97 Alt+F11 won't work so find the button on the toolbar that says "code" in the controltip text instead. Gord
ghubbell@total.net
 
Gord

Was just about to say that is not working, when you mailed again! Thanks for the help, fingers crossed i will get it sorted.

Matt
 
Gord - got it working now.

Thanks for that, your a top man!

Don't go running off though - probably need you tomorrow knowing me!

Thanks

Matt
 
HELP!! I have the same exact problem except that when I go to Compile, I get the following error message: "Compile error. Ambiguous name detected: CPCData_Click"

What next????
 
Follw the same instructions as in the prev post and look for the name CPCData_Click see if its there more than once. Zorro
 
Zorro-
I did that already. I deleted whatever was in the code. I have another post since this original one was rather old and I wasn't sure that anyone would respond.

I was able to get 4 out of my 5 buttons to work properly. I have one that is being very stubborn and will not link properly.

Thanks for responding. :-D
 
Here is the code:

Private Sub CPC_Information_Click()
On Error GoTo Err_CPC_Information_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_CPCData"

stLinkCriteria = "[PIN]=" & Me![PIN]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_CPC_Information_Click:
Exit Sub

Err_CPC_Information_Click:
MsgBox Err.Description
Resume Exit_CPC_Information_Click

End Sub

Thanks again!
 
Either you DO have another chunk of code somewhere called CPCData_Click or Ms. Access has gotten confused. Did you try compacting the database? Terry M. Hoey
 
Terry-
Tried compacting, no good. Is there somewhere else that I should look for additional code? How can I "unconfuse" Ms. Access???? X-)
 
What is the code for the entire form.Based on what you are showing us it should be fine unless that name is used somehwere esle for another sub. Zorro
 
Where would I have to look to find the code for the entire form?
 
If you open the form in design view, in the top left corner, there is a little box that you can double click on to open the form's properties. Go to the events tab and select an event and then click on the elipse (...) to the right. All of the functions for the form should appear. Verify that there is not a dupe in there. Also do the same for each of your controls on the form (properties, events, look at the code). Make sure that there are no other functions with that name.

Other than that, I am lost without being able to look at it myself... Terry M. Hoey
 
For the CPC Data form, when I go into design and go to the events tab, there are no functions.

Unfortunately this is work related so I couldn't even ZIP it and send it.

I too am at a total loss.
Thanks anyway for trying to help. The attempt is much appreciated. (-:
 
When you copied the code for the button that wasn't working you were in the VB editor. Copy the code from that whole page not just for the specified button and paste it here. That way we can look over the whole page of code. Zorro
 
I just rebuilt the whole CPC Data form with a different name and created a button and it works. The problem must be with the CPC Data form itself.

Here is the code for all of the buttons :

Private Sub QM_Worksheet_Click()
On Error GoTo Err_QM_Worksheet_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_QMWorkSheet"

stLinkCriteria = "[PIN]=" & Me![PIN]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_QM_Worksheet_Click:
Exit Sub

Err_QM_Worksheet_Click:
MsgBox Err.Description
Resume Exit_QM_Worksheet_Click

End Sub
Private Sub Provider_Data_Click()
On Error GoTo Err_Provider_Data_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_DemoInfo"

stLinkCriteria = "[PIN]=" & Me![PIN]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Provider_Data_Click:
Exit Sub

Err_Provider_Data_Click:
MsgBox Err.Description
Resume Exit_Provider_Data_Click

End Sub
Private Sub Network_Data_Click()
On Error GoTo Err_Network_Data_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_Network_info"

stLinkCriteria = "[PIN]=" & Me![PIN]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Network_Data_Click:
Exit Sub

Err_Network_Data_Click:
MsgBox Err.Description
Resume Exit_Network_Data_Click

End Sub
Private Sub Sanction_Data_Click()
On Error GoTo Err_Sanction_Data_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_SanctionData"

stLinkCriteria = "[PIN]=" & Me![PIN]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Sanction_Data_Click:
Exit Sub

Err_Sanction_Data_Click:
MsgBox Err.Description
Resume Exit_Sanction_Data_Click

End Sub
Private Sub Meeting_Information_Click()
On Error GoTo Err_Meeting_Information_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_CPCData"

stLinkCriteria = "[PIN]=" & Me![PIN]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Meeting_Information_Click:
Exit Sub

Err_Meeting_Information_Click:
MsgBox Err.Description
Resume Exit_Meeting_Information_Click

End Sub
Private Sub Provider_Meeting_Info_Click()
On Error GoTo Err_Provider_Meeting_Info_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_Meeting Data"

stLinkCriteria = "[PIN]=" & Me![PIN]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Provider_Meeting_Info_Click:
Exit Sub

Err_Provider_Meeting_Info_Click:
MsgBox Err.Description
Resume Exit_Provider_Meeting_Info_Click

End Sub

If you can locate the error from here, I will try to repair. If not, I'll go with the new form/button.

Thanks again. :cool:
 
I don't see the code you originally posted in this last posting. Am I missing something? Zorro
 
Probably not. I've been playing with this button trying to get it to work and deleting as I go. The first code below is for a button that I deleted that didn't work. The second code is for the button for the new form that does work.

Private Sub Meeting_Information_Click()
On Error GoTo Err_Meeting_Information_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_CPCData"

stLinkCriteria = "[PIN]=" & Me![PIN]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Meeting_Information_Click:
Exit Sub

Err_Meeting_Information_Click:
MsgBox Err.Description
Resume Exit_Meeting_Information_Click

End Sub
Private Sub Provider_Meeting_Info_Click()
On Error GoTo Err_Provider_Meeting_Info_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F_Meeting Data"

stLinkCriteria = "[PIN]=" & Me![PIN]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Provider_Meeting_Info_Click:
Exit Sub

thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top