My Assistant
![]() ![]() |
|
|
Apr 21 2005, 05:26 PM
Post
#1
|
|
|
UtterAccess Enthusiast Posts: 83 |
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
Post
#2
|
|
|
UtterAccess Member Posts: 30 From: Ireland |
I think this might work, try
DoCmd.RunCommand acCmdRemoveFilterSort 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. Voyager |
|
|
|
Apr 21 2005, 06:01 PM
Post
#3
|
|
|
UtterAccess Enthusiast Posts: 83 |
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
Post
#4
|
|
|
UtterAccess Member Posts: 30 From: Ireland |
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 Voyager |
|
|
|
Apr 22 2005, 01:45 AM
Post
#5
|
|
|
UA Admin Posts: 19,250 From: Newcastle, WA |
"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 George |
|
|
|
Apr 22 2005, 08:53 PM
Post
#6
|
|
|
UtterAccess VIP Posts: 6,250 From: Khon Kaen, Thailand |
What about this?
Private Sub Command0_Click() DoCmd.ShowAllRecords End Sub (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif) |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 24th May 2013 - 11:01 PM |