Error message on a Combo box used to find a record on a form

G

Guest

I am trying to create a Combo box on a form in Access 2000 that will find a
record based on the value selected in the Combo box. I used the wizard to
create the Combo box in the form header and it has several fields that appear
in the Combo box to allow the user to select the correct record. I am
getting the following error message:
"The expression After Update you entered as the event property setting
produced the following error: Ambiguous name detected: Print_Issue_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.

I have compared the properties of this Combo box to others in other
databases that are functioning but can't find anything different. Any help
anyone can provide would be greatly appreciated.

Jennifer
 
W

Wayne Morgan

In the combo box's properties, events tab, do you have AfterUpdate set to
"[Event Procedure]" or to "Print_Issue_Click"? If you open the form's code
module are there two procedures called Print_Issue_Click? Is there another
procedure anywhere in the database called Print_Issue_Click? If so and if it
has Public scope, it will cause a problem. Have you deleted recreated the
control called Print_Issue?
 
G

Guest

The code for this Combo box is as follows:
Private Sub Combo34_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![Combo34])
Me.Bookmark = rs.Bookmark
End Sub

There is code referring to Print_Issue_Click and it reads as follows:

Private Sub Print_Issue_Click()
On Error GoTo Err_Print_Issue_Click


DoCmd.PrintOut

Exit_Print_Issue_Click:
Exit Sub

Err_Print_Issue_Click:
MsgBox Err.Description
Resume Exit_Print_Issue_Click

End Sub
Private Sub Print_Issue_Click()
On Error GoTo Err_Print_Issue_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

Exit_Print_Issue_Click:
Exit Sub

Err_Print_Issue_Click:
MsgBox Err.Description
Resume Exit_Print_Issue_Click

End Sub
Private Sub Print_Issue_Click()
On Error GoTo Err_Print_Issue_Click

Dim stDocName As String

stDocName = "MCR_Print_Form_Currently_Viewing"
DoCmd.RunMacro stDocName

Exit_Print_Issue_Click:
Exit Sub

Err_Print_Issue_Click:
MsgBox Err.Description
Resume Exit_Print_Issue_Click

End Sub

I'm sure this is probably more information than you need but it's pretty
much Greek to me so I thought I'd include it all in case it is helpful. As
far as I'm aware, I have not done anything to the Print_Issue (I'm not even
sure what that does, to be honest). Thanks so much for your help!

Jennifer

Wayne Morgan said:
In the combo box's properties, events tab, do you have AfterUpdate set to
"[Event Procedure]" or to "Print_Issue_Click"? If you open the form's code
module are there two procedures called Print_Issue_Click? Is there another
procedure anywhere in the database called Print_Issue_Click? If so and if it
has Public scope, it will cause a problem. Have you deleted recreated the
control called Print_Issue?

--
Wayne Morgan
MS Access MVP


Jennifer White said:
I am trying to create a Combo box on a form in Access 2000 that will find a
record based on the value selected in the Combo box. I used the wizard to
create the Combo box in the form header and it has several fields that
appear
in the Combo box to allow the user to select the correct record. I am
getting the following error message:
"The expression After Update you entered as the event property setting
produced the following error: Ambiguous name detected: Print_Issue_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.

I have compared the properties of this Combo box to others in other
databases that are functioning but can't find anything different. Any
help
anyone can provide would be greatly appreciated.

Jennifer
 
W

Wayne Morgan

You do have 2 Print_Issue_Click procedures. That is the problem.
Private Sub Print_Issue_Click() <<<<First Instance
On Error GoTo Err_Print_Issue_Click


DoCmd.PrintOut

Exit_Print_Issue_Click:
Exit Sub

Err_Print_Issue_Click:
MsgBox Err.Description
Resume Exit_Print_Issue_Click

End Sub
Private Sub Print_Issue_Click() <<<<<<<Duplicate Here
On Error GoTo Err_Print_Issue_Click

As you'll see, right after the EndSub of the first procedure, you have
another procedure with the same name. There should be a control on the form
called Print_Issue and when you click that control (most likely a button,
but not necessarily) the code should run. If there is no control called
Print_Issue, then the code is left over from something that has been deleted
and the code can safely be deleted also. However, if there is still a
control called Print_Issue, you will need to know what it is supposed to do
when you click it to know which of these two procedures is the correct one.

The code should have never been saved this way. Whenever you (or whoever)
make code changes, they should go to the Debug menu in the code editor and
choose Compile... before closing and saving. The compiler will catch errors
such as this. (The compile option may not be available if you only change
one line of code until you move the cursor off of that line of code.)

--
Wayne Morgan
MS Access MVP


Jennifer White said:
The code for this Combo box is as follows:
Private Sub Combo34_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![Combo34])
Me.Bookmark = rs.Bookmark
End Sub

There is code referring to Print_Issue_Click and it reads as follows:

Private Sub Print_Issue_Click()
On Error GoTo Err_Print_Issue_Click


DoCmd.PrintOut

Exit_Print_Issue_Click:
Exit Sub

Err_Print_Issue_Click:
MsgBox Err.Description
Resume Exit_Print_Issue_Click

End Sub
Private Sub Print_Issue_Click()
On Error GoTo Err_Print_Issue_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

Exit_Print_Issue_Click:
Exit Sub

Err_Print_Issue_Click:
MsgBox Err.Description
Resume Exit_Print_Issue_Click

End Sub
Private Sub Print_Issue_Click()
On Error GoTo Err_Print_Issue_Click

Dim stDocName As String

stDocName = "MCR_Print_Form_Currently_Viewing"
DoCmd.RunMacro stDocName

Exit_Print_Issue_Click:
Exit Sub

Err_Print_Issue_Click:
MsgBox Err.Description
Resume Exit_Print_Issue_Click

End Sub

I'm sure this is probably more information than you need but it's pretty
much Greek to me so I thought I'd include it all in case it is helpful.
As
far as I'm aware, I have not done anything to the Print_Issue (I'm not
even
sure what that does, to be honest). Thanks so much for your help!
 
G

Guest

Perfect!!!! Thank you so much for taking the time to help me, and especially
for responding so quickly! You're a life saver!!

Wayne Morgan said:
You do have 2 Print_Issue_Click procedures. That is the problem.
Private Sub Print_Issue_Click() <<<<First Instance
On Error GoTo Err_Print_Issue_Click


DoCmd.PrintOut

Exit_Print_Issue_Click:
Exit Sub

Err_Print_Issue_Click:
MsgBox Err.Description
Resume Exit_Print_Issue_Click

End Sub
Private Sub Print_Issue_Click() <<<<<<<Duplicate Here
On Error GoTo Err_Print_Issue_Click

As you'll see, right after the EndSub of the first procedure, you have
another procedure with the same name. There should be a control on the form
called Print_Issue and when you click that control (most likely a button,
but not necessarily) the code should run. If there is no control called
Print_Issue, then the code is left over from something that has been deleted
and the code can safely be deleted also. However, if there is still a
control called Print_Issue, you will need to know what it is supposed to do
when you click it to know which of these two procedures is the correct one.

The code should have never been saved this way. Whenever you (or whoever)
make code changes, they should go to the Debug menu in the code editor and
choose Compile... before closing and saving. The compiler will catch errors
such as this. (The compile option may not be available if you only change
one line of code until you move the cursor off of that line of code.)

--
Wayne Morgan
MS Access MVP


Jennifer White said:
The code for this Combo box is as follows:
Private Sub Combo34_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![Combo34])
Me.Bookmark = rs.Bookmark
End Sub

There is code referring to Print_Issue_Click and it reads as follows:

Private Sub Print_Issue_Click()
On Error GoTo Err_Print_Issue_Click


DoCmd.PrintOut

Exit_Print_Issue_Click:
Exit Sub

Err_Print_Issue_Click:
MsgBox Err.Description
Resume Exit_Print_Issue_Click

End Sub
Private Sub Print_Issue_Click()
On Error GoTo Err_Print_Issue_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

Exit_Print_Issue_Click:
Exit Sub

Err_Print_Issue_Click:
MsgBox Err.Description
Resume Exit_Print_Issue_Click

End Sub
Private Sub Print_Issue_Click()
On Error GoTo Err_Print_Issue_Click

Dim stDocName As String

stDocName = "MCR_Print_Form_Currently_Viewing"
DoCmd.RunMacro stDocName

Exit_Print_Issue_Click:
Exit Sub

Err_Print_Issue_Click:
MsgBox Err.Description
Resume Exit_Print_Issue_Click

End Sub

I'm sure this is probably more information than you need but it's pretty
much Greek to me so I thought I'd include it all in case it is helpful.
As
far as I'm aware, I have not done anything to the Print_Issue (I'm not
even
sure what that does, to be honest). Thanks so much for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top