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

Always Load Form with the same filter applied

Status
Not open for further replies.

Renasant

Technical User
Feb 19, 2009
31
GB
I need a form to always open with a certain filter applied rather than the last filter applied. I wrote the filter in advanced filter/sort and saved it as a query.

I have tried two methods to define the query as my filter. I used the Form Property Sheet and tried the <Advanced Filter/sort> <Load From query>.

When I try to use the Form Property Sheet to define my query as the filter in the form property sheet I get a syntax error. It says that I am missing an operator. I do not know what syntax to use to get the query to work as my form filter.

The <advanced filter/sort> <load from query> did not work either. The query is not available in the Applicable Filter list when I try this method.

How do I define my query as the filter to use when users open the form?
 
Typically, I open a form with code like:
Code:
Dim strWhere as String
strWhere = "[Active] = True"
DoCmd.OpenForm "frmMyFormName", , , strWhere
The strWhere creates a WHERE CONDITION that gets passed to the Filter property of the form.

I never have users open a form from the database window since they should never see the database window.

Duane
Hook'D on Access
MS Access MVP
 
I do not have the skills to do the sequel. I need to know how to do this in Access 2007.
 
Thanks Duane. That makes sense. I got the change in place and it works!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top