I have a database that has lots of records. I made (3) sorts on the top of the form to filter the data. I am trying to use 2 or 3 of the sorts at one time. Instead it picks one sort and uses it, and then throws records that I am not using in there that I have supposedly limited out.
I think I have the wrong code on my search button. Btw, the individual search works. :)
How do you put all those together?
Thanks
I think I have the wrong code on my search button. Btw, the individual search works. :)
Code:
Private Sub cmdFind_Click()
Dim GCriteria As String
'Check for blank criteria
If IsNull(cmbSort1) And IsNull(cmbSort2) And IsNull(cmbSort3) Then
MsgBox "You must enter search criteria..."
Exit Sub
End If
'First Sort
'Generate Category search criteria
If Not IsNull(Me.cmbSort1) Then
GCriteria = "tblRequest.StatusQuotaID = " & Me.cmbSort1.value
End If
'Second Sort
'Generate Rating search criteria
If Not IsNull(Me.cmbSort2) Then
GCriteria = "tblRequest.NameID = " & Me.cmbSort2.value
End If
'Third Sort
'Generate Rating search criteria
If Not IsNull(Me.cmbSort3) Then
GCriteria = "tblRequest.ImportanceID = " & Me.cmbSort3.value
End If
'Filter frmAll based on search criteria
Forms!frmrequest!frmRequestAll.Form.RecordSource = "SELECT tblReviewNames.Name, tblImportance.Importance, tblRequest.Comments, tblRequest.Date, tblRequest.Request, tblRequest.Problem, tblRequest.RequestID, tblRequest.Completed, tblStatusQuota.StatusQuotaName FROM (((tblRequest INNER JOIN tblStatusQuota ON tblRequest.StatusQuotaID = tblStatusQuota.StatusQuotaID) INNER JOIN tblReviewNames ON tblRequest.NameID = tblReviewNames.NameID) INNER JOIN tblImportance ON tblRequest.ImportanceID = tblImportance.ImportanceID) INNER JOIN tblDivisions ON tblRequest.DivisionID = tblDivisions.Division WHERE (((" & GCriteria & ")<>False));"
End Sub
Thanks
Comment