Combining Text and Yes/No In Filter

P

pbudzik

In a reply on 6-11-2004 On filtering Yes/No fields, Alan Brown
responded with:
Re: Filtering form on True-False check boxes
This example assumes you have *unbound* check boxes on your for
(probably
in the form header), and you want to apply a filter based on whicheve
ones
are checked. It visits each one, building up a filter string from th
ones
that are True, and then applies it to the filter of the form:

Dim strFilter As String
Dim lngLen As Long

If Me.chkProblems.Value Then
strFilter = strFilter & "(Problems = True) AND "
End If
If Me.chkInactive.Value Then
strFilter = strFilter & "(Inactive = True) AND "
End If
'etc for other boxes.
lngLen = Len(strFilter) - 5 'Without trailing " AND ".
If lngLen <=0 Then
Me.FilterOn = False
Else
strFilter = Left$(strFilter, lenLen)
Me.Filter = strFilter
Me.FilterOn = True
End If

Could this be adapted to include a wildcard text search along wit
yes/no boxe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top