Same query with filter

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
 
M

Marshall Barton

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]
 
S

Smiley

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]
 
Top