471,892 Members | 1,318 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,892 software developers and data experts.

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 1208
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 YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.