Use a form control value to filter query only if form is loaded.

  • Thread starter Thread starter Chrisso
  • Start date Start date
C

Chrisso

Hi All

I have a query that joins a bunch of tables in my database.

Is it possible to configure the query such that one of the field's
criteria in the query is set only if a particular form is loaded?

That is, when my form is loaded I want to filter the query based on a
value that is on the form.

If the form is not loaded then I want no filtering and therefore see
all records.

Is this possible? Have I got my design all back to front or something?

Thanks in advance for any ideas and help,
Chrisso
 
Hi

No problems use IsNull to the set the criteria in the query for the form not
being open (it other words the criteria is null)

Something like this
Filter: Forms![YourFormNameHere]![YourFormControlHere] Or
Forms![YourFormNameHere]![YourFormControlHere] Is Null
 
Sorry just re-read your post ooops (the other answer would still work BTW)
but you could set the crieria on the forms OnOpen event - bit better than way
 
Sorry just re-read your post ooops (the other answer would still work BTW)
but you could set the crieria on the forms OnOpen event - bit better than way

--
Wayne
Manchester, England.











- Show quoted text -

Thanks Wayne.

The query is a large query that takes a couple of seconds to display
so I want to filter it as soon as possible for a quicker load -
therefore I will use your 1st suggestion - otherwise I have to wait
for the form to load, the full query to execute and then the form will
filter (I am assuming this sequence).

So I will try your second option in the query criteria - seems to work
on a very quick test. I will keep you posted.

Cheers
Chrisso
 
Back
Top