?
Solved

Clearing a Filter by Form

Posted on 2003-03-25
4
Medium Priority
?
970 Views
Last Modified: 2008-02-01
Hello everyone, Heres my question!

I am using "DoCmd.RunCommand acCmdFilterByForm" to open a form in "Filter by Form" mode. This allows the user to create a custom filter to their liking. Once run, the user can then us a button I have created to push the "filtered" results to a generic report I have created. The problem I am having is more of an anoyance than anything. After filtering the records accroding to their needs. Another use may try to use this feature and find the criteria the last user entered on the "Filter by Form" screen. He/she can delete this criteria and eneter their own, but if they miss something it will fudge the reulting data.

I would like the "Filter by Form" to be cleared (no values in any field) when the user selects the button containing "DoCmd.RunCommand acCmdFilterByForm" . Can this be done and if so, anyone have any ideas?

ty

syntnx
0
Comment
Question by:syntnx
  • 2
4 Comments
 
LVL 1

Expert Comment

by:Wowbagger_TIP
ID: 8205120
Just put this line before the filterbyform line:

Me.Filter = vbNullString
0
 
LVL 3

Author Comment

by:syntnx
ID: 8205252
Didnt seem to work. Im not real familar with VB, is the following systax correct?

DoCmd.OpenForm "frmAgreementsFilter",acNormal, "", "",
acEdit, acNormal
Me.Filter = vbNullString
DoCmd.RunCommand acCmdFilterByForm

syntnx
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 500 total points
ID: 8206021
Try this:
DoCmd.OpenForm "frmAgreementsFilter"
Forms!frmAgreementsFilter.Form.Filter=""
DoCmd.RunCommand acCmdFilterByForm

You don't need all the extra parameters after the form name if you just want to pass the defaults.

You could also put this in the OnFilter event of the frmAgreementsFilter form instead:
Me.Filter = "" (as suggested by Wowbagger_TIP)
If you do this, then the filter is also cleared if the user decides to go back into Filter-By-Form later on.
0
 
LVL 3

Author Comment

by:syntnx
ID: 8210781
You've done it again! Wowbagger_TIP I have posted some points for you too at http://www.experts-exchange.com/Databases/MS_Access/Q_20563840.html

Thanks

syntnx
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
A quick solution showing how to control and open a POS Cash Register Drawer using VBA with MS Access.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question