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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button to "Apply Filter" after a FilterByForm is Launched

Status
Not open for further replies.

DeoM

Programmer
Jul 3, 2004
49
PH
Hi,
I noticed that when i do a FilterByForm, all buttons and boxes on the form are deactivated except the boxes "fields" where i can choose to use as filter. Is there a way that i can create a button on the form which i can click to "apply filter" instead of using the regular Menu.
 
Code:
Private Sub CmdApplyfilter_Click()
       Screen.PreviousControl.SetFocus
       DoCmd.RunCommand acCmdFilterByForm
End Sub
Click on a field then command button to filter. You need to have command button to remove filter

there are some more commands available with RunCommand.

________________________________________
Zameer Abdulla
Visit Me
A child may not be able to lift too much.
But it can certainly hold a marriage together
 
Hi,
I created a button on the button to "ApplyFilter" of hatever field i chose data in it. The problem is when i click on the button i created which runs "FilterByForm", the "ApplyFilter" button is automatically disabled. How can i make this button stay enabled?
 
I don't think you can. You can place a commandbutton/label on the header or footer of the form and utilize it's Click event to apply/remove filter(filter by selection)
[tt]
If Me.FilterOn = False Then
DoCmd.RunCommand acCmdFilterBySelection
Else
DoCmd.RunCommand acCmdRemoveFilterSort
End If
[/tt]
For filter by form easiest method is to create a custom toolbar with your own choice of buttons on it.

________________________________________
Zameer Abdulla
Visit Me
A child may not be able to lift too much.
But it can certainly hold a marriage together
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top