Hi, I'm trying to search/filter 2 subforms on the main form, this is the code:
Code:
Private Sub btnSearch_Click()
Dim MempSQL As String
Dim BercSQL As String
MempSQL = "SELECT Complaint, ComplaintEdited, " _
& "Preparation, PreparationEdited, " _
& "Administration, AdministrationEdited, " _
& "PartUsed, TimesRecorded, Healer, " _
& "SpeciesID, ComplaintID, FloraPalComplaintID " _
& "FROM MempComplaintTom " _
& "Where Complaint LIKE '*" & Me.txtSearch & "*';"
Me.MempComplaintSubFrm.Form.RecordSource = MempSQL
Me.MempComplaintSubFrm.Form.Requery
BercSQL = "SELECT SpeciesID, ComplaintID, System, Complaint, TimesRecorded, " _
& "PartsUsed, Preparation, Administration, InformationSource, ScientificStudies " _
& "FROM BercComplaints " _
& "Where Complaint LIKE '*" & Me.txtSearch & "*';"
Me.BercComplaintsSF.Form.RecordSource = BercSQL
Me.BercComplaintsSF.Form.Requery
End Sub
The strange thing is only the first filter works, and if comment out one of the queries the other will work.
Can anyone explain to me what's going on, and how I can fix it.
Thanks
David