3464 Data Type Mismatch in Criteria Expression

G

Guest

I have a double-click event that's making me nuts. I'm getting the 3464 error
message and the debugger points to the line below in ><

Any ideas what's wrong? I'm drowning!

Private Sub cbSupplier_DblClick(Cancel As Integer)

If IsNull(Me!cbSupplier) Then
' no supplier ID selected; show all ...
DoCmd.OpenForm "frmPKSuppliers"
Else
' Show selected supplier name.
' First, open frmPKSuppliers to show the supplier name ...
DoCmd.OpenForm "frmPKSuppliers", _
WhereCondition:="txtSupplierName=""" & _
Me!cbSupplier.Column(1) & """"
' Now position the subform, sfrmSupplierIDs,
' to the selected ID ...
With Forms!frmPKSuppliers!sfrmSupplierIDs.Form
.Recordset.FindFirst _
"txtSupplierID=" & Me!cbSupplier.Column(0)<
End With
End If

End Sub
 
B

Bob Quintal

I have a double-click event that's making me nuts. I'm getting the
3464 error message and the debugger points to the line below in ><

Any ideas what's wrong? I'm drowning!

Private Sub cbSupplier_DblClick(Cancel As Integer)

If IsNull(Me!cbSupplier) Then
' no supplier ID selected; show all ...
DoCmd.OpenForm "frmPKSuppliers"
Else
' Show selected supplier name.
' First, open frmPKSuppliers to show the supplier
name ... DoCmd.OpenForm "frmPKSuppliers", _
WhereCondition:="txtSupplierName=""" & _
Me!cbSupplier.Column(1) & """"
' Now position the subform, sfrmSupplierIDs,
' to the selected ID ...
With Forms!frmPKSuppliers!sfrmSupplierIDs.Form
"txtSupplierID=" & Me!cbSupplier.Column(0)<
End With
End If

End Sub
The findfirst needs to see quotes around the value it gets from
the combobox like this
"txtSupplierID=""" & Me!cbSupplier.Column(0) & """"
 
G

Guest

My guess is that txtSupplierID is a text data type. Your code syntax is
treating it like a numeric field. Also is txtSupplierID a field in the
form's recordset or is it a control on the form. It should be the name of a
field in your recordset.
If it is text, the code should be:
"txtSupplierID= '" & Me!cbSupplier.Column(0) & "'"

Also your code will not position the record. You have to first find the
value then set the bookmark. Here is how it should be:

With Forms!frmPKSuppliers!sfrmSupplierIDs.Form.RecordsetClone
.FindFirst "txtSupplierID= '" & Me!cbSupplier.Column(0) & "'"
If Not .NoMatch Then
Me.SupplierIDs.Form.Bookmark = .Bookmark
End If
End With

My guess is that
 
M

Marshall Barton

JohnLute said:
I have a double-click event that's making me nuts. I'm getting the 3464 error
message and the debugger points to the line below in >< []
.Recordset.FindFirst _
"txtSupplierID=" & Me!cbSupplier.Column(0)<


If the txtSupplierID field in the table is a Text field,
then use quotes around the value:

"txtSupplierID=""" & Me!cbSupplier.Column(0) & """ "
 

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