Error: Ambigious Name Detected

Cat

Registered User.
Local time
Today, 23:05
Joined
May 8, 2002
Messages
19
I have a form called "Revenue Form". I wanted to add a command button to my main form called "Add Revenue". I have a tried the Open form on the Command Button Wizard and also have tried creating a Macro to open the form. Either way I get an error message - " The expression On Click you entered as the Event Property setting produced the following error: Ambigious Name Detected: Revenue_Button_Click_"

What have I done wrong?

Thanks
 
It is the only button that I have created.
 
I can see that the code records an error but don't know what I have done wrong.

Option Compare Database

Private Sub Revenue_Button_Click()
On Error GoTo Err_Revenue_Button_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "FRM Revenue Data Entry"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Revenue_Button_Click:
Exit Sub

Err_Revenue_Button_Click:
MsgBox Err.Description
Resume Exit_Revenue_Button_Click

End Sub
Private Sub Exit_Data_Entry_Button_Click()
On Error GoTo Err_Exit_Data_Entry_Button_Click


DoCmd.Close

Exit_Exit_Data_Entry_Button_Click:
Exit Sub

Err_Exit_Data_Entry_Button_Click:
MsgBox Err.Description
Resume Exit_Exit_Data_Entry_Button_Click

End Sub
Private Sub Revenue_Button_Click()
On Error GoTo Err_Revenue_Button_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "FRM Revenue"

stLinkCriteria = "[Area to Canvass ID]=" & Me![Area to Canvass ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Revenue_Button_Click:
Exit Sub

Err_Revenue_Button_Click:
MsgBox Err.Description
Resume Exit_Revenue_Button_Click

End Sub
Private Sub Revenue_Button_Click()
On Error GoTo Err_Revenue_Button_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "FRM Revenue"

stLinkCriteria = "[Area to Canvass ID]=" & Me![Area to Canvass ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Revenue_Button_Click:
Exit Sub

Err_Revenue_Button_Click:
MsgBox Err.Description
Resume Exit_Revenue_Button_Click

End Sub
Private Sub Revenue_Button_Click()
On Error GoTo Err_Revenue_Button_Click

Dim stDocName As String

stDocName = "Command Button Items.Revenue"
DoCmd.RunMacro stDocName

Exit_Revenue_Button_Click:
Exit Sub

Err_Revenue_Button_Click:
MsgBox Err.Description
Resume Exit_Revenue_Button_Click

End Sub
Private Sub Revenue_Button_Click()
On Error GoTo Err_Revenue_Button_Click

Dim stDocName As String

stDocName = "Command Button Items.Revenue"
DoCmd.RunMacro stDocName

Exit_Revenue_Button_Click:
Exit Sub

Err_Revenue_Button_Click:
MsgBox Err.Description
Resume Exit_Revenue_Button_Click

End Sub
Private Sub Money_Button_Click()
On Error GoTo Err_Money_Button_Click

Dim stDocName As String

stDocName = "Command Button Items.Revenue"
DoCmd.RunMacro stDocName

Exit_Money_Button_Click:
Exit Sub

Err_Money_Button_Click:
MsgBox Err.Description
Resume Exit_Money_Button_Click

End Sub
Private Sub Add_Money_Button_Click()
On Error GoTo Err_Add_Money_Button_Click

Dim stDocName As String

stDocName = "Command Button Items.Revenue Form"
DoCmd.RunMacro stDocName

Exit_Add_Money_Button_Click:
Exit Sub

Err_Add_Money_Button_Click:
MsgBox Err.Description
Resume Exit_Add_Money_Button_Click

End Sub


Thanks for looking it over.
 
Rich is right, you have the same button name several times.
 

Users who are viewing this thread

Back
Top Bottom