open form based on query criteria?

B

Brook

good day all,

I have a form that I use to track and view inventory, and I have
inventory in several different catagories. (i.e. cat 1, cat 2, cat 3, etc.),
based on qryinventory.

What I would like to do is when my form opens, have the user select what
catagory, catagories they would like to view in the form ( which I would
assum would be coded in some fashion before hand). Would it be possible to
have it where the user could chose only Cat 1 or Cat 2 or Cat 3 or a
combination of the 3?

Does anyone have any suggestions? I would like to not have to set up
separate qry's for all the options I want to do.

Thanks in advance...

Brook
 
D

Douglas J Steele

Probably the best approach is to have your query select everything, and then
apply a filter in your form.

After your user has indicated which selections he/she wants, you'd need to
use code like:

Me.Filter = "Cat = 1"
Me.FilterOn = True

The Filter is set to an appropriate WHERE clause (without the word WHERE)
 
B

Brook

Hello Douglas,

Thanks for the response,

How would I have the user apply the selection they want? With a pop up
box?

Thanks,

Brook
 
D

Douglas J Steele

Lots of possibilities.

One would be to bring up the form with everything on it, and have an option
box or listbox from which they can pick the options. Once they pick, apply
the filter.

Another would be to create a pop-up form that you can call in the form's
Load event to get the information from the user, and apply the filter so
that they don't see unwanted data at all.

A third would be, as I believe you're suggesting, using the InputBox to
accept input from them.
 
Top