Form to get parameters for a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report that lists spend by customer. It is based on a query which
requests the customer number I want the report for.

Can anyone please advise me as to how to build (or point me in the direction
of an example of) a form which will pop up when the query is called and will
pass the customer number field parameter (from a combo box) to the query.

Regards

Peter
 
Peter

Create a new form. Add a combo box that lists customers (CustomerNumber,
CustomerName). Add a command button that opens the report.

Modify the query that "feeds" the report to include a criterion for the
customer number. That criterion points to the form's combo box with
something like (your syntax may vary):

Forms!frmYourNewForm!cboYourCustomerNumberComboBox

When you click the command button, the code opens the report, the report
looks to the query, the query looks (back) to the form and uses the
CustomerNumber in the combo box.

An alternate way to handle this is to use a query without the criterion, and
in the command button code, open the report with a Filter or a Where clause
in the syntax (see Access HELP for the OpenReport syntax).
 
Back
Top