Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another filter questions:

Status
Not open for further replies.

gator9

Technical User
May 17, 2002
162
US
Another filter questions:

I have a combo box named [Filter]. I have this combo box unbound. It also has the row source as Call Later, More Info, and waiting for call back. Now Call Later, More Info, and waiting for call back all have a check box associated with them you can check when the situation permits it. How do I get this combo box to filer let say all the call laters that are checked when I drop down to that value?


Sincerely,

Charles
 
Hi Charles,

assuming that the associated field names aren't the same as the combo values try,
Code:
Private Sub myComboBox_OnChange()
    dim sFilter as string

    select Case myCombo
        Case "Call Later"
            sFilter = "FIELD_CALL_LATER = TRUE"
        Case "More Info"
            sFilter = "FIELD_MORE_INFO = TRUE"

        Case "waiting for call back"
            sFilter = "FIELD_CALL_BACK = TRUE"

    end select

    me.filter = sFilter
    me.filteron = true
End Sub
you'll also need a button or switch with me.filteron = not me.filteron to switch the filter on or off.

To be honest though, since you are using a combobox I assume that you can only have 1 option selected at a time so why not enumerate your options and have one column? Its a much more flexible table design...

HTH, Jamie
FAQ219-2884
[deejay]
 
I got it! It is a value list and the code below is the one that works.

Private Sub myComboBox_Change()
dim sFilter as string

select Case myComboBox
Case "Call Later"
sFilter = "FIELD_CALL_LATER = TRUE"
Case "More Info"
sFilter = "FIELD_MORE_INFO = TRUE"

Case "waiting for call back"
sFilter = "FIELD_CALL_BACK = TRUE"

end select

me.filter = sFilter
me.filteron = true
End Sub


Sincerely,

Charles
 
Here is the accual code I am using and rather than put a button to show all records I anned case.

Private Sub myComboBox_Change()
Dim sFilter As String

Select Case myComboBox

Case "Show All Records"
sFilter = True

Case "Call Later"
sFilter = "SCCallLater = TRUE"

Case "More Info"
sFilter = "SCMoreInfo = TRUE"

Case "Waiting For Call"
sFilter = "SCWaitingCall = TRUE"

Case "Filed Suit"
sFilter = "FiledSuit = TRUE"

Case "Demand Letter Sent"
sFilter = "AddFee = TRUE And FiledSuit = False"

Case "Suggestion For Suit"
sFilter = "SuitArchive = TRUE"

Case "Unable To Collect"
sFilter = "UnableToCollect = TRUE"

Case "Daily Task"
sFilter = "RecordAccessed <Date()-30 And SuitArchive = False And FiledSuit = False And UnableToCollect = False And AddFee = False And Chapter13 = False And Chapter11 = False And ReturnedMail = False And SCMoreInfo = False"

End Select
Me.Filter = sFilter
Me.FilterOn = True
End Sub

Sincerely,

Charles
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top