Passing criteria to a query

scottappleford

Registered User.
Local time
Today, 21:29
Joined
Dec 10, 2002
Messages
134
Hi

I have recently started using queries to base my forms on. Even for basic forms i am using the query as the record source.

If for example i have a standard query with no criteria e.g. a employee form. How would i then use that query to create a report that filters for example a list of employees for a certain company?

Would i have to create a seperate query to base the report on? because the form when opened will always filter that criteria?

If this is the case, is there a way to keep a query set up with no criteria but when the object being used is opened some code will pass to the query the criteria e.g. a combo box on a form list all the companies and when one is selected it passes this to the query e.g. without the criteria already being in the query?

Hope that makes sense.

thanks

scott
 
Code:
DoCmd.OpenReport

Will open a report and allow you to set a filter on that report without filtering the query. That should help you acheive what you want. Just read up on OpenReport in the help files, its pretty straighforward.
 

Users who are viewing this thread

Back
Top Bottom