Print Report Code

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

Guest

I have a report with code that runs several commands that genaertas data for
the report on activate. I have a preview set on this report and the code is
run when preview is clicked. When preview is printed the code is re-run and
the improper data is displayed. I would like to preview the report and run
the code and then print the report with out running the code again. Any
advise would be greatly appreciated...
 
The code is run a second time because the data may have changed between when
you previewed it and when you printed it. To have the code run only once,
you need to go directly to print rather than opening the report in preview
first.
 
Thanks for the input.
The data does not get changed the user plugs in values to view the report.
The preview allows the user to validate values on screen then print the
report. As it is now I have a preview then a print button that prints the
screen no problem. Unfortunatley the user wants to print directly from what
they see on the screen. When the report is printed it reruns the code within
the report and changes the input values. I need to figure out to stop the
code from running a second time, and just print what is there.
 
Thanks for the input.
The data does not get changed the user plugs in values to view the report.
The preview allows the user to validate values on screen then print the
report. As it is now I have a preview then a print button that prints the
screen no problem. Unfortunatley the user wants to print directly from what
they see on the screen. When the report is printed it reruns the code within
the report and changes the input values. I need to figure out to stop the
code from running a second time, and just print what is there.

If you want a specific answer you have to provide specific
information.
What is the code?. Where is it placed?
What is the Preview data?
What is the data when printed?
 
The code is a series of steps that calculates costs and budgets and year
allocated. I did not write it.The preview data is a report that gets
generated from the data calculated by the code. The data when printed is the
report. The code is based in a report and runs everytime it is previewed or
printed. The issue is the print preview report is the correct data, when it
is printed the code gets re-run and the data is incorrect, not the data in
the print preview.
 
The code is a series of steps that calculates costs and budgets and year
allocated. I did not write it.The preview data is a report that gets
generated from the data calculated by the code. The data when printed is the
report. The code is based in a report and runs everytime it is previewed or
printed. The issue is the print preview report is the correct data, when it
is printed the code gets re-run and the data is incorrect, not the data in
the print preview.

It's like pulling teeth.
You just are not going to offer any constructive information.
Where (in what event) is this code placed?
What is the actual data supposed to be when Previewed?
What is the actual data when printed?

Is the printed data double the Preview value?

The data is computed when previewed then computed again when printed.

If so, I would guess that you have not re-set your controls value to 0
in the report Header Format event.

That's the best I can offer you on what you have posted.
 
It looks as if you are correct I found one other person having this issue.
Here is what I am looking at

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

End Sub
 
You cannot stop Access from recreating the report so if it is your code that
is causing the problem, you will need to modify the code so that it doesn't
come up with different values the second time it is run. As fredg as
suggested a couple of times, posting the code will likely get you a more
precise answer.
 

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

Back
Top