linking a query to a report

K

Kevin Sprinkel

-----Original Message-----
I am trying to make a query that when I open my report, it
will prompt me for a product name from a table I've
created, then after I type in the name, it will open the
report with all the corresponding info. from my table. I
am fairly new at this, so any suggestions would be really
helpful! Thanks!

There are two general approaches: using a parameter query
(which Jim describes), and using a Form. The latter is
more flexible, simpler, and easier for your user, although
somewhat more difficult to implement.

In either case, to use the query as the basis of the
report, open your report in Design view, right click the
Black Box at the top left and choose Properties to display
the form properties. Under the Data tab, change the
Record Source to the name of your query.

For the latter, start a new form in Design view. With the
Wizard icon depressed, place a new Combo Box on the form.
The wizard will open; say you want to look up your value
from a table or query, select the key field and the Name
fields, and choose Hide Key Field, resize the column to
display the full field, give the box a meaningful label.
When you're returned to form design view, right click on
the combo box to display its properties. Under the Other
tab, note the value of the Name field, or preferably, give
the control a more meaningful Name, such as
cboCompanyName. Now place a command button on the form,
again using the wizard, and telling it you want it to open
your report when the button is clicked.

The only thing left is to tell the query to use the value
in the form's combo box as its selection criteria. In the
Criteria row, enter:

=Forms!yourformname!yourcomboboxname

HTH
Good luck
Kevin Sprinkel
Becker & Frondorf
 
Top