I have a filter that filter through all of my records to find those that match all criteria in the filter.
However this section of code is used to filter 2 date range criteria.
Code:
If (strWhere <> "") Then strWhere = "(" & Mid(strWhere, 6) & ")"
If (Chk_log_date) And Not (IsNull(DT_log_date1.Value)) Then
strDate = " AND [Opportunities].[Bid Required By] >= " & _
"#" & Format$(DT_log_date1.Value, "mm/dd/yyyy") & "#"
End If
If Not (IsNull(DT_log_date2.Value)) Then
strDate = strDate & " AND [Opportunities].[Bid Required By] <= " & _
"#" & Format$(DT_log_date2.Value, "mm/dd/yyyy") & "#"
End If
If (Check191) And Not (IsNull(ActiveXCtl194.Value)) Then
strDate = " AND [Opportunities].[Enquiry Date] >= " & _
"#" & Format$(ActiveXCtl194.Value, "mm/dd/yyyy") & "#"
End If
If Not (IsNull(ActiveXCtl195.Value)) Then
strDate = strDate & " AND [Opportunities].[Enquiry Date] <= " & _
"#" & Format$(ActiveXCtl195.Value, "mm/dd/yyyy") & "#"
End If
If (strWhere <> "") Then
strWhere = strWhere & strDate
Else
strWhere = Mid(strDate, 6)
End If
If (strWhere <> "") Then strSQL = strSQL & "WHERE " & strWhere
When used seperately (eg when Enquiry Date is used in the filter without bid required being included in the filter criteria) they work fine. however when used together the data is only filtered for "enquiry date" AND NOT " BID REQUIRED BY"
Does anybody know why this is happening??