Reports

G

Greenner

I have a Data base that tracks vehicle maint. I need to add report for each
vehicle. I have a report that will give every record of Maintanence, but
what I would like is upon click on the command botton to run the report for a
dialog box to open asking what vehicle to use for the report.
 
J

JohnR

There are 2 ways I can think of to do this.

In the query that feeds the report add [Enter Truck Name] as the criteria
for the truck name field. Then when the report opens, the user is prompted
to enter the truck name, which filters the query and give a single report.

The other way would be to build a form with a drop box listing all the
available trucks. The user would select a truck and then click the button
to open the report. All you would have to do is add the strCriteria value
to the button code.
 
L

Larry Linson

Greenner said:
I have a Data base that tracks vehicle maint.
I need to add report for each vehicle. I have
a report that will give every record of Mainta-
nence, but what I would like is upon click on
the command botton to run the report for a
dialog box to open asking what vehicle to
use for the report.

You can do what you want with a separate form, which could be a dialog form,
but seems easier if you add an unbound ComboBox to the Form where you click
the Command Button to run the report, with a label saying "To report for a
single vehicle, choose here, else click the 'Run Report' button.", the Row
Source to show each vehicle. In the After Update event, fill in the
WhereCondition of the DoCmd.OpenReport with the selected vehicle. You can
either open the report at that point or wait until the CommandButton is
clicked. If the 'Run Report' Command Button is clicked, and nothing is
selected in the Combo Box, run the report for all vehicles.

Larry Linson
Microsoft Office Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top