Filter Subform from user input

gream0604

New member
Local time
Today, 13:46
Joined
Oct 5, 2011
Messages
6
Hello all,

I have a main form (frmMainMenu) and a subform (frmSub).

I already have a number of filters, which filter by specific data. Here is the code i am using for that:

Code:
With Me.frmsub.Form
.Filter = "[Franchise] =" & """Abarth"""
.FilterOn = True
End With
I am wondering if i can using something similar to either prompt for a user input, or for the user to type what they want to filter in a text box, and filter by that?

Thanks

Matt
 
Hello all,

I have a main form (frmMainMenu) and a subform (frmSub).

I already have a number of filters, which filter by specific data. Here is the code i am using for that:

Code:
With Me.frmsub.Form
.Filter = "[Franchise] =" & """Abarth"""
.FilterOn = True
End With
I am wondering if i can using something similar to either prompt for a user input, or for the user to type what they want to filter in a text box, and filter by that?


Thanks

Matt


Hi,

You can filter on as many fields as you like. Just use 'AND' after each item
i.e.

Code:
With Me.frmsub.Form
.Filter = "[Franchise] = 'Abarth' AND [YourField] = '" & [YourTextBox] & "'"
.FilterOn = True
End With

Hope this helps.
 
If you're going to use a textbox, you can do:
Code:
If Len(Nz([B]Me.[COLOR=Red]txtboxName[/COLOR][/B], "")) <> 0 Then
    With Me.frmsub.Form
        .Filter = "[Franchise] = '" & [B]Me.[COLOR=Red]txtBoxNam[/COLOR][/B][COLOR=Red]e[/COLOR] & "'"
        .FilterOn = True
    End With
End If
 

Users who are viewing this thread

Back
Top Bottom