D
Darhl Thomason
In my Access 2003 db, I have a StatusID field that I want to filter on. I
am using check boxes so I can pick multiple filters, but it only works when
one of the check boxes is selected. If I select multiple check boxes, the
filter returns no data. Could someone please look at my filter code and
tell me what I'm missing.
'Select Store Status Filter
If Me.chkCompleted = True Then
If Not IsNull(strFilter) Then strFilter = strFilter & " And "
strFilter = strFilter & "tblStoreData.StatusID = 1"
End If
If Me.chkScheduled = True Then
Me.tglUpcomingStores.Enabled = True
If Not IsNull(strFilter) Then strFilter = strFilter & " And "
strFilter = strFilter & "tblStoreData.StatusID = 2"
End If
If Me.chkPending = True Then
If Not IsNull(strFilter) Then strFilter = strFilter & " And "
strFilter = strFilter & "tblStoreData.StatusID = 3"
End If
'End Select Store Status Filter
If I select the first check box, then the strFilter returns
"tblStoreData.StatusID = 1"
If I select the first and second check box, the strFilter returns
"tblStoreData.StatusID = 1 And tblStoreData.StatusID = 2"
If I select all three check boxes, the strFilter returns
"tblStoreData.StatusID = 1 And tblStoreData.StatusID = 2 And
tblStoreData.StatusID = 3"
As far as I can tell, the filter is correct, but something's not quite
right.
Thanks for any help!
Darhl
am using check boxes so I can pick multiple filters, but it only works when
one of the check boxes is selected. If I select multiple check boxes, the
filter returns no data. Could someone please look at my filter code and
tell me what I'm missing.
'Select Store Status Filter
If Me.chkCompleted = True Then
If Not IsNull(strFilter) Then strFilter = strFilter & " And "
strFilter = strFilter & "tblStoreData.StatusID = 1"
End If
If Me.chkScheduled = True Then
Me.tglUpcomingStores.Enabled = True
If Not IsNull(strFilter) Then strFilter = strFilter & " And "
strFilter = strFilter & "tblStoreData.StatusID = 2"
End If
If Me.chkPending = True Then
If Not IsNull(strFilter) Then strFilter = strFilter & " And "
strFilter = strFilter & "tblStoreData.StatusID = 3"
End If
'End Select Store Status Filter
If I select the first check box, then the strFilter returns
"tblStoreData.StatusID = 1"
If I select the first and second check box, the strFilter returns
"tblStoreData.StatusID = 1 And tblStoreData.StatusID = 2"
If I select all three check boxes, the strFilter returns
"tblStoreData.StatusID = 1 And tblStoreData.StatusID = 2 And
tblStoreData.StatusID = 3"
As far as I can tell, the filter is correct, but something's not quite
right.
Thanks for any help!
Darhl