Same query with filter

  • Thread starter Thread starter Smiley
  • Start date Start date
S

Smiley

I want to use one query but apply it to 4 different forms. So if Category
field = 1 then only display items with Category =1 on form1, if Category =
2, all items with category = 2 display on form 2. Is this possible ? If so
how.

Many thanks
 
Smiley said:
I want to use one query but apply it to 4 different forms. So if Category
field = 1 then only display items with Category =1 on form1, if Category =
2, all items with category = 2 display on form 2. Is this possible ? If so
how.


One or two newsgroups would have been sufficient, no need to
crosspost to so many groups.

The best way to do that is to create a master form to open
your form. The code behind a command button to open your
form with a specific category could be something like:

DoCmd.OpenForm "name of the form", , , "Category=1"

Alternatively, you could have a text or combo box on the
master form where users can enter or select the category.
Then the query can use a criteria of this type:
=Forms![name of master form].[name of text box]
 
Thanks Marshall

Marshall Barton said:
Smiley said:
I want to use one query but apply it to 4 different forms. So if Category
field = 1 then only display items with Category =1 on form1, if Category =
2, all items with category = 2 display on form 2. Is this possible ? If so
how.


One or two newsgroups would have been sufficient, no need to
crosspost to so many groups.

The best way to do that is to create a master form to open
your form. The code behind a command button to open your
form with a specific category could be something like:

DoCmd.OpenForm "name of the form", , , "Category=1"

Alternatively, you could have a text or combo box on the
master form where users can enter or select the category.
Then the query can use a criteria of this type:
=Forms![name of master form].[name of text box]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top