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:01
Joined
Sep 17, 2001
Messages
939
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
 
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. 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

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
 

Users who are viewing this thread

Back
Top Bottom