Many Reports with the same Parameters

D

Dee

I have over 10 reports that use parameter queries. They
all ask the user for a "Date or Skip this box and enter
From and To in the next boxes". No problem there.

I would like to create 1 dialog form that would open on
the OnOpen for any report so the user will have a calendar
icon for easier date entry.

Something like:

Date to Print: (would default to today)
From:
To:

OK button would then run the report with the parameters to
the query.

How can I pass the Report Name and parameters to run? Does
anyone have any code that already does this?

Is there an easier way?

Appreciate any thoughts!
 
L

Larry Linson

Why do you not take one of the Forms you use and make it "generic" by adding
a Combo Box listing the Reports. Construct the DoCmd OpenReport from the
contents of the three Combo Boxes rather than the two that you are using
now.

I see no particular advantage in opening the Form from the Report's Open
Event.

Larry Linson
Microsoft Access MVP
 
D

Dee

Larry,
That sounds like a great idea! And it sounds easy, but I'm
sorry that I don't fully understand all that I need to
do. Can you give me an example syntax for the DoCmd?

Assuming, one Report name is "Jobs Completed" and the
unbound text boxes [yes?] are named Starting and Ending.
 
L

Larry Linson

Open a module, type in DoCmd.OpenReport, put the cursor on that command and
press F1 -- it is well-documented in Help.

The WhereCondition argument is a "WHERE clause without the WHERE". You'll
find an example of the corresponding DoCmd.OpenForm in the sample imaging
databases at http://accdevel.tripod.com -- it is how the detail Forms are
opened from the list of records.

For your example, the WHERE might be built as

Dim strWhere as String
. . .
strWhere = "[JobDate] BETWEEN #" & Me!Starting & _
"# AND #" & Me!Ending & "#"
DoCmd.OpenReport "Jobs Completed",,,strWhere

Larry Linson
Microsoft Access MVP


Dee said:
Larry,
That sounds like a great idea! And it sounds easy, but I'm
sorry that I don't fully understand all that I need to
do. Can you give me an example syntax for the DoCmd?

Assuming, one Report name is "Jobs Completed" and the
unbound text boxes [yes?] are named Starting and Ending.
-----Original Message-----
Why do you not take one of the Forms you use and make it "generic" by adding
a Combo Box listing the Reports. Construct the DoCmd OpenReport from the
contents of the three Combo Boxes rather than the two that you are using
now.

I see no particular advantage in opening the Form from the Report's Open
Event.

Larry Linson
Microsoft Access MVP




.
 
D

Dee

Thanks, Larry...I think I can figure it out now. Really
appreciate your help!
-----Original Message-----
Open a module, type in DoCmd.OpenReport, put the cursor on that command and
press F1 -- it is well-documented in Help.

The WhereCondition argument is a "WHERE clause without the WHERE". You'll
find an example of the corresponding DoCmd.OpenForm in the sample imaging
databases at http://accdevel.tripod.com -- it is how the detail Forms are
opened from the list of records.

For your example, the WHERE might be built as

Dim strWhere as String
. . .
strWhere = "[JobDate] BETWEEN #" & Me!Starting & _
"# AND #" & Me!Ending & "#"
DoCmd.OpenReport "Jobs Completed",,,strWhere

Larry Linson
Microsoft Access MVP


Larry,
That sounds like a great idea! And it sounds easy, but I'm
sorry that I don't fully understand all that I need to
do. Can you give me an example syntax for the DoCmd?

Assuming, one Report name is "Jobs Completed" and the
unbound text boxes [yes?] are named Starting and Ending.
-----Original Message-----
Why do you not take one of the Forms you use and make it "generic" by adding
a Combo Box listing the Reports. Construct the DoCmd OpenReport from the
contents of the three Combo Boxes rather than the two that you are using
now.

I see no particular advantage in opening the Form from the Report's Open
Event.

Larry Linson
Microsoft Access MVP

I have over 10 reports that use parameter queries. They
all ask the user for a "Date or Skip this box and enter
From and To in the next boxes". No problem there.

I would like to create 1 dialog form that would open on
the OnOpen for any report so the user will have a calendar
icon for easier date entry.

Something like:

Date to Print: (would default to today)
From:
To:

OK button would then run the report with the
parameters
to
the query.

How can I pass the Report Name and parameters to run? Does
anyone have any code that already does this?

Is there an easier way?

Appreciate any thoughts!


.


.
 

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