Solved When saving a report to file it is saving more than one report instead of just the one i want filed (1 Viewer)

Sam Summers

Registered User.
Local time
Today, 22:16
Joined
Sep 17, 2001
Messages
844
When saving a report to file it is saving more than one report instead of just the one i want filed:-

I am using this code:

Code:
    DoCmd.OutputTo acOutputReport, "SafetyInformationCard", "", "", False, "", 0

I am using the same for another two reports which works fine and does not create additional reports within the same pdf?

Thank you in advance

Sam
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:16
Joined
Oct 29, 2018
Messages
16,158
Hi. Not sure I understand. When you say "additional reports," are you talking about multiple pages or actual reports from your database. You know, like saving Report1 and Report2 and Report3 also get saved?
 

Sam Summers

Registered User.
Local time
Today, 22:16
Joined
Sep 17, 2001
Messages
844
Hi. Not sure I understand. When you say "additional reports," are you talking about multiple pages or actual reports from your database. You know, like saving Report1 and Report2 and Report3 also get saved?
Hi there,
So i have just tested how it prints and it prints the two pages fine using this code:

Code:
DoCmd.OpenReport "SafetyInformationCard", , , ("[RiskAssessmentID] = " & Forms!ViewAllRiskAssessments![RiskAssessmentID])

But when i save to file i get this - as attached?
 

Attachments

  • SafetyInformationCard.pdf
    165 KB · Views: 124

bastanu

AWF VIP
Local time
Today, 14:16
Joined
Apr 13, 2010
Messages
859
It is because OutputTo method doesn't have the Where condition like OpenReport. You will have to modify the report's record source to return only one record (RiskAssessmentID) or open the report hidden then call the OutputTo with an empty report name argument (it will save the current open report):
Code:
DoCmd.OpenReport "SafetyInformationCard", , , ("[RiskAssessmentID] = " & Forms!ViewAllRiskAssessments![RiskAssessmentID]), acHidden

DoCmd.OutputTo acOutputReport, , "", "", False, "", 0

Cheers,
Vlad
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:16
Joined
May 7, 2009
Messages
13,727
is ok if i put the "criteria" directly to the Recordsource of the report?
 

Attachments

  • Safey Risk Assessment.zip
    1.1 MB · Views: 39

Users who are viewing this thread

Top Bottom