views:

53

answers:

2

I have a simple Access macro that opens two forms and filters them based on input from the user.

I used parameter queries to accomplish this, so my Where condition for both reports reads:

[PONumber]=[Enter PO Number]

As it currently stands, an input box pops up twice - once for each report. I was hoping that I could somehow re-use the value from the first input box.

How do I accomplish this?

A: 

Consider presenting a form to your users. Add a text box control, txtPONumber, to the form. Change the WHERE condition in your queries to :

[PONumber]=Forms!YourFormName!txtPONumber

Finally add a command button to your form to open the queries.

Also consider creating additional forms for each query; the form should use the query as its RecordSource. The command button would then open the forms rather than the queries directly. You have more control by presenting data in forms rather than allowing the users to open queries (or tables) in datasheet view.

HansUp
+2  A: 

I would dissent from @HansUp's answer. Don't hardwire any criteria into your saved QueryDefs, nor into the recordsources of forms and reports. Instead, open the forms/reports with WHERE criteria chosen by opening an unbound form to collect the relevant criteria.

David-W-Fenton
+1 I like yours better.
HansUp
This is what I ended up doing. Very effective and it feels more like a "real program" to my end users.
retailevolved