Passing Date Selection to Report

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

Guest

I have a form on which a command button allows the user to run a report in
preview mode. This shows all data for all dates.

I need to be able to allow the user to enter a start and end date and then
pass those values to a query which will then display the appropriate records
in the report preview. The report is already designed and is called
ExpenseDetailRpt.

I have built a form to enter the values QStartDate and QEndDate with a
button to run the report after entering the values. I'm familiar with how to
create a query with the criteria set to the values Between the two dates
entered on the form, but I don't know what to set the Click event to to run
the query and THEN display the report in preview mode.

Any help would be appreciated.
 
JHK said:
I have a form on which a command button allows the user to run a report in
preview mode. This shows all data for all dates.

I need to be able to allow the user to enter a start and end date and then
pass those values to a query which will then display the appropriate
records
in the report preview. The report is already designed and is called
ExpenseDetailRpt.

I have built a form to enter the values QStartDate and QEndDate with a
button to run the report after entering the values. I'm familiar with how
to
create a query with the criteria set to the values Between the two dates
entered on the form, but I don't know what to set the Click event to to
run
the query and THEN display the report in preview mode.

Any help would be appreciated.
 
JHK,
You don't use your open report button to run the query... if the query is
the RecordSource for the report, it "runs" whenever the report is opened.
DoCmd.OpenReport "ExpenseDetailRpt"
runs the query associated with the report.

In that query behind your report, in your date field (ex. SaleDate), use
this criteria...
Between Forms!frmYourFormName!QStartDate AND Forms!frmYourFormName!QEndDate
to filkter the report according top the values on your open form.

hth
Al Camp
 
Back
Top