Apr 21 2005, 05:26 PM
Hello. I'm wondering if anyone could provide me with the OnClick code for a command button. I want the button to remove all filters on a form (I know the user can just go to the "Records" menu heading in Access 2003, but I want to automate this feature). Hopefully an easy one.
Apr 21 2005, 05:41 PM
I think this might work, try
Hope this works,
If it doesnt you could create a macro, using the run command and selecting remove filter and then link the macro to your buttons on click event.
Apr 21 2005, 06:01 PM
Yeah. That should work, but something werid is going on. I have designed a combo box filter with 8 options (based on records in a table). This feature works mostly.
However, I just realized that even if the "Remove Filter" TOOLBAR button is pressed ,the form doesn't actually show all of the records. It just shows the records for the first option in the combo box. The combo box (no default value set) does not change when filters are removed.
Any idea what is going on?
Apr 21 2005, 06:08 PM
Im not very good at this but maybe if you set the default value of the combobox to just this ""
I use this in my search form as it is a null value (i think), not sure if it will work for you though
But if it doesnt check out this site below, I find it very good at teaching some new things and improving on what I already have, it might also have a solution to your problem as well DataPig Technologies
Apr 22 2005, 01:45 AM
"Filter" as you are using it here, refers only to a filter on the form's recordsource. It has nothing to do with combo or list boxes on the form, as you've learned.
However, I don't think that is the issue here.
First, we need to know how you apply the filter to the form's recordsource in the first place? The form only shows records for the first option in the combobox? How does that work? Do you have code in the "After_Upate" event of the combo box that applies a filter to the form's recordsource, like this?
Me.Filter = "PrimaryKey = " & Me.CboFilter
Me.FilterOn = True
Apr 22 2005, 08:53 PM
What about this?
Private Sub Command0_Click()
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here