424,066 Members | 2,076 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,066 IT Pros & Developers. It's quick & easy.

What's wrong with this multiple criteria search code?

P: 4
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
1 Week Ago #1
Share this Question
Share on Google+
1 Reply


P: 4
Never mind... I figured it out!! sorry
1 Week Ago #2

Post your reply

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