Reputation: 1
In Access I try to search using a combobox. I have 2 combo boxes, one of them works normally but another have an issue with.
The failing code is as follows:
Private Sub ComName_Click()
Dim EmName As String
EmName = "SELECT * FROM tbl_Order WHERE AssignedTo = '" & Me.ComName & "'"
Me.SearchForm.Form.RecordSource = EmName
Me.SearchForm.Form.Requery
End Sub
and face run-time error 3464 "data type mismatch in criteria expression":
Upvotes: 0
Views: 81
Reputation: 55981
EmpID is most likely numeric, thus:
EmName = "SELECT * FROM tbl_Order WHERE AssignedTo = " & Me.ComName & ""
Upvotes: 1