Hazem AboRawash
Hazem AboRawash

Reputation: 1

Access combobox issue?

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":

run-time error, data type mismatch in criteria expression

enter image description here

Upvotes: 0

Views: 81

Answers (1)

Gustav
Gustav

Reputation: 55981

EmpID is most likely numeric, thus:

EmName = "SELECT * FROM tbl_Order WHERE  AssignedTo = " & Me.ComName & ""

Upvotes: 1

Related Questions