Parameter error when printing

O

Opal

I should know this but I can't get it to work. I have a report that
contains two
subreports. There is a 'Between' statement on the underlying criteria
for the query on each report so that the user can select a date range
for
the reports. It comes up perfectly in print preview, but when the
user
tries to print the report, access requests the begin date and end date
criteria again. How can I prevent this from happening?
 
F

fredg

I should know this but I can't get it to work. I have a report that
contains two
subreports. There is a 'Between' statement on the underlying criteria
for the query on each report so that the user can select a date range
for
the reports. It comes up perfectly in print preview, but when the
user
tries to print the report, access requests the begin date and end date
criteria again. How can I prevent this from happening?

You should use a form for the entry of the parameter dates.
As long as the form remains open, you will not be prompted again.

Make a new unbound form.
Add 2 unbound text controls to the form.
Set their Format property to any valid date format.
Name one "StartDate".
Name the other "EndDate".

Add a command button to the form.
Code the button's Click event:
Me.Visible = False
Name this form "ParamForm"

In each query that is used as record source for any of these reports,
As Criteria on the DateField, write:
Between forms!ParamForm!StartDate and forms!ParamForm!EndDate

Code the Main Report's Open Event:
DoCmd.OpenForm "ParamForm" , , , , , acDialog

Code the Main Report's Close event:
DoCmd.Close acForm, "ParamForm"

Run the Report.
The report will open the form.

Enter the starting and ending dates.
Click the command button.

The Report and it's sub-reports will display just those records for
the range selected and you will not be prompted for the dates.
When the Report closes it will close the form.
 
O

Opal

You should use a form for the entry of the parameter dates.
As long as the form remains open, you will not be prompted again.

Make a new unbound form.
Add 2 unbound text controls to the form.
Set their Format property to any valid date format.
Name one "StartDate".
Name the other "EndDate".

Add a command button to the form.
Code the button's Click event:
Me.Visible = False
Name this form "ParamForm"

In each query that is used as  record source for any of these reports,
As Criteria on the DateField, write:
Between forms!ParamForm!StartDate and forms!ParamForm!EndDate

Code the Main Report's Open Event:
DoCmd.OpenForm "ParamForm" , , , , , acDialog

Code the Main Report's Close event:
DoCmd.Close acForm, "ParamForm"

Run the Report.
The report will open the form.

Enter the starting and ending dates.
Click the command button.

The Report and it's sub-reports will display just those records for
the range selected and you will not be prompted for the dates.
When the Report closes it will close the form.

Is that what it is? I already have a pop-up dialog form for entering
the
begin and end date and have it set to close when the report
opens in print preview. So, you are saying I shouldn't close
this form until I close the report and this will solve the issue?
 
D

Duane Hookom

Opal: "So, you are saying I shouldn't close this form until I close the
report and this will solve the issue?"

FredG: "As long as the form remains open, you will not be prompted"

Duane: "You don't need permission to try this and report back ;-)"
 
O

Opal

Opal: "So, you are saying I shouldn't close this form until I close the
report and this will solve the issue?"

FredG: "As long as the form remains open, you will not be prompted"

Duane: "You don't need permission to try this and report back ;-)"

--
Duane Hookom
Microsoft Access MVP






- Show quoted text -

Cute, Duane... :)

Thank you fredg, it works very well, but why does the report
"minimize" on my
task bar? Can this be corrected?
 
O

Opal

Your form looks to be opened acDialog. Try make the form invisible.
--
Duane Hookom
Microsoft Access MVP







- Show quoted text -

per fredg's suggestion, I did the following:

Code the button's Click event:
Me.Visible = False

and once I click okay on the parameter form, the report opens
and minimizes on the task bar.
 
F

fredg

per fredg's suggestion, I did the following:

Code the button's Click event:
Me.Visible = False

and once I click okay on the parameter form, the report opens
and minimizes on the task bar.

Check the rest of the code in the report.
Is there anything in there like
DoCmd.Minimize
 
O

Opal

** snipped **





Check the rest of the code in the report.
Is there anything in there like
DoCmd.Minimize

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail- Hide quoted text -

- Show quoted text -

Nope, I checked that, nothing.
 

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