Selection Combo Box Problem

M

Marco

Hi Everyone
I have a Data Base with Active and Inactive Clients. All the client are
in one table with a check box Active and Inactive. I have set up a
filter that allows me to open a form with only Active Client
view/filtered. A filter that allows me to open a form with only
InActive Client view/filtered. A the top of these forms I have placed a
Selection Combo Box by Client Name that will allow me to view all the
client and jump to that record. It works great if I am viewing all the
records but if it is filter it seems to be broken. How can I make this
work in filtered and unfilter mode?

Private Sub Combo182_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[ClientID] = " & Str(Nz(Me![Combo182], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

best regards
Marco
www.classactinsurance.com
 
A

Allen Browne

Test if the form's FilterOn property is set, and if so, see if the filter
contains the text you use to see if the Active field is True or False.

Something like this:

Dim strWhere As String
strWhere = "(ClientID = " & Nz(Me.Combo182,0) & ")"

If Me.FilterOn Then
If Me.Filter Like "*Active = True*" Then
strWhere = strWhere & " AND (Active = True)"
ElseIf Me.Filter Like "*Active = False*" Then
strWhere = strWhere & " AND (Active = True)"
End If
End If

rs.FindFirst strWhere
If ...
 
Top