Error 3079: specified field cold refer to more than one table...

G

Guest

Here's the error message I'm getting:
The specified field <field> could refer to more than one table listed in the
FROM clause of your SQL statement. (Error 3079)

Here's the row source of the relative combo box:
SELECT tblCustomerIDs.txtCustomerID, tblCustomerNames.txtCustomerName,
tblCustomerIDs.City1, tblCustomerIDs.StateOrProvince1 FROM tblCustomerNames
INNER JOIN tblCustomerIDs ON tblCustomerNames.txtCustomerName =
tblCustomerIDs.txtCustomerName ORDER BY tblCustomerIDs.txtCustomerID;

Here's the code for the combo box:
Private Sub cbRejectingCustomer_DblClick(Cancel As Integer)
If IsNull(Me!cbRejectingCustomer) Then
' no customer ID selected; show all ...
DoCmd.OpenForm "frmCustomers"
Else
' Show selected customer ID.
' First, open frmCustomers to show the customer ...
DoCmd.OpenForm "frmCustomers", _
WhereCondition:="txtCustomerName='" & _
Me!cbRejectingCustomer.Column(1) & "'"
' Now position the subform, sfrmCustomerIDs,
' to the selected ID ...
With Forms!frmCustomers!sfrmCustomerIDs.Form
.Recordset.FindFirst _
"txtCustomerID=" & Me!cbRejectingCustomer.Column(0)<
End With
End If
End Sub

The debugger points to the code lines I placed in ><.

Anyone see why I'm getting this error message...?

THANKS!
 
G

Guest

txtCustomerID is the field name in both tables. so the
compiler don't know which table to get it from.
add the table name in front of the field name either
tblCustomerIDs or tblCustomerNames which ever one you want,
the same way it appears in the query.
example:
"tblCustomerIDs.txtCustomerID=" & Me!
cbRejectingCustomer.Column(0)<
but use which table is appropreate.
-----Original Message-----
Here's the error message I'm getting:
The specified field <field> could refer to more than one table listed in the
FROM clause of your SQL statement. (Error 3079)

Here's the row source of the relative combo box:
SELECT tblCustomerIDs.txtCustomerID, tblCustomerNames.txtCustomerName,
tblCustomerIDs.City1, tblCustomerIDs.StateOrProvince1 FROM tblCustomerNames
INNER JOIN tblCustomerIDs ON
tblCustomerNames.txtCustomerName =
 
G

Guest

Thanks for the reply!

I tried your suggestion but now I get this error:
Data type mismatch in criteria expression. (Error 3464)
The criteria expression in a Find method is attempting to compare a field
with a value whose data type does not match the field’s data type.

The debugger points to the code line:

..Recordset.FindFirst _
"tblCustomerIDs.txtCustomerID=" & Me!
cbRejectingCustomer.Column(0)

???

txtCustomerID is the field name in both tables. so the
compiler don't know which table to get it from.
add the table name in front of the field name either
tblCustomerIDs or tblCustomerNames which ever one you want,
the same way it appears in the query.
example:
"tblCustomerIDs.txtCustomerID=" & Me!
cbRejectingCustomer.Column(0)<
but use which table is appropreate.
-----Original Message-----
Here's the error message I'm getting:
The specified field <field> could refer to more than one table listed in the
FROM clause of your SQL statement. (Error 3079)

Here's the row source of the relative combo box:
SELECT tblCustomerIDs.txtCustomerID, tblCustomerNames.txtCustomerName,
tblCustomerIDs.City1, tblCustomerIDs.StateOrProvince1 FROM tblCustomerNames
INNER JOIN tblCustomerIDs ON
tblCustomerNames.txtCustomerName =
 

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