I have a single text box(txtRxSearch) form that searches for a specific record. This works when I am searching a single field in a table. I now want to expand the search to 2 fields where the user can enter one of two values. I am getting a Error 13 Type mismatch. Both RxNumber and RxBCNumber are defined as Strings. I tried to enter it into a query to see the structure, but still cannot get it to work. Any help appreciated.
You don't know what you don't know...
Code:
Private Sub cmdOK_Click()
Dim strWhere As String
If Not IsNull(Me.txtRxSearch) Then
'strWhere = "[RxNumber] = """ & Me.txtRxSearch & """" 'This works
strWhere = "RxNumber = """ & Me.txtRxSearch & """" Or "RxBCNumber = """ & Me.txtRxSearch & """" 'this does not work
End If
DoCmd.OpenForm "frmAddPrescription", , , strWhere
DoCmd.Close acForm, "frmRefillSearch"
End Sub
You don't know what you don't know...