469,126 Members | 1,232 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,126 developers. It's quick & easy.

What's wrong with this multiple criteria search code?

9
I encountered a Type Mismatch error in the below line. Not sure how to best code this (error BOLDED). Please help.

Dim GCriteria As String
Dim strDate As String

If Len(Patient_Search) = 0 Or IsNull(Patient_Search) = True Then
MsgBox "You must enter a text to search."

Else

'Generate search criteria
GCriteria = cboSearchField.Value & " LIKE '*" & Patient_Search & "*'"
strDate = cboSearchDate.Value & " Between #" & Me.From & "# AND #" & Me.Thru & "#"

'Filter Referrals based on search criteria
Form_Referrals.RecordSource = "select * from [All Referrals Query] where " & GCriteria And strDate

Form_Referrals.Caption = "Referrals Search (" & cboSearchField.Value & " contains '*" & Patient_Search & "*')"

'Close Frm_Search
DoCmd.Close acForm, "Frm_Search"

MsgBox "Results have been filtered with part of patient's name within the date range (Blank = no match)."

End If
Jan 9 '19 #1
1 1111
pcheng
9
Never mind... I figured it out!! sorry
Jan 9 '19 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

mmarif4u
2 posts views Thread by mmarif4u | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.