On click error appearing

Chimp8471

Registered User.
Local time
Today, 09:36
Joined
Mar 18, 2003
Messages
353
i have a form, that i have added a button, when i click the button i get the following message.


The expression on click you entered as the event property setting produced the following error: Ambiguous name detected: LME_Click.

*The expression may 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



can someone please explain this in very basic terms, and the best way around fixing it please.

the code behind the button is.....



Private Sub LME_Click()
On Error GoTo Err_LME_Click

'Calls the calender form and set calstartref
Dim stDocName As String
Dim stLinkCriteria As String

CalStartRef = "LME"

stDocName = "frmCalender"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_LME_Click:
Exit Sub

Err_LME_Click:
MsgBox Err.Description
Resume Exit_OpenCalOEE_Click

End Sub



my buttons name is : LME
My form name is: LME


please help

Andy
 
You have two procedures in the same module called LME_CLick - delete the erroneous one.

Remember to use naming conventions though; that's three things called LME; you'll end up confusing yourself. (i.e. cmdLME, frmLME)
 
you lost me!!!!

which is this:

delete the erroneous one.
 
Somewhere in your module there are two subroutines that begin Private Sub LME_Click() and end End Sub - delete the one that shouldn't be there.
 
right this is every bit of code on that form...

i have changed the button name to button_LME

and the form name to frmLME


Option Compare Database
Option Explicit

Private Sub Options()
Select Case OptionGroupName
Case 1
DoCmd.OpenReport "LME_H0", acViewPreview
Case 2
DoCmd.OpenReport "LME_H1", acViewPreview
Case 3
DoCmd.OpenReport "LME_H2", acViewPreview
Case 4
DoCmd.OpenReport "LME_H3", acViewPreview
Case 5
DoCmd.OpenReport "LME_H4", acViewPreview
Case 6
DoCmd.OpenReport "LME_H5", acViewPreview
Case 7
DoCmd.OpenReport "LME_H6", acViewPreview
Case 8
DoCmd.OpenReport "LME_H7", acViewPreview
Case 9
DoCmd.OpenReport "LME_H8", acViewPreview
Case 10
DoCmd.OpenReport "LME_H9", acViewPreview
Case 11
DoCmd.OpenReport "LME_CO", acViewPreview
Case 12
DoCmd.OpenReport "LME_C1", acViewPreview
Case 13
DoCmd.OpenReport "LME_C2", acViewPreview
Case 14
DoCmd.OpenReport "LME_C3", acViewPreview
Case 15
DoCmd.OpenReport "LME_C4", acViewPreview
Case 16
DoCmd.OpenReport "LME_C5", acViewPreview
Case 17
DoCmd.OpenReport "LME_T3", acViewPreview
Case 18
DoCmd.OpenReport "LME_V2", acViewPreview
Case 19
DoCmd.OpenReport "LME_D2", acViewPreview
Case 20
DoCmd.OpenReport "LME_B2", acViewPreview
Case 21
DoCmd.OpenReport "LME_F", acViewPreview
Case 22
DoCmd.OpenReport "LME_S1", acViewPreview
Case Else
MsgBox "please select a line"
End Select

End Sub

Private Sub button_LME_Click()
On Error GoTo Err_button_LME_Click

'Calls the calender form and set calstartref
Dim stDocName As String
Dim stLinkCriteria As String

CalStartRef = "frmLME"

stDocName = "frmCalender"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_button_LME_Click:
Exit Sub

Err_button_LME_Click:
MsgBox Err.Description
Resume Exit_button_LME_Click
End Sub


buit now i get a different message:-

The expression on click you entered as the event property setting produced the following error: Member already exists in a object module from which this object module derives

*The expression may 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


this is doing my head in now.....Help!!!!
 
i have attached a sample of my database, that produces the error
 

Attachments

You have this:

Code:
Private Sub Options()

but it's not linked to any of the events of the Option Group called Options like this:


Code:
Private Sub Options_AfterUpdate()
 

Users who are viewing this thread

Back
Top Bottom