[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 384
  • Last Modified:

Report Snapshot

Hi there !
How can I do a silent snapshot of a report ?
I'm using this :

stDocName = "rptCategory"
DoCmd.OpenReport stDocName, acPreview, , "[IDCategory] =" & Me.IDCategory, acHidden
DoCmd.OutputTo acOutputReport, stDocName, "Snapshot Format", "C:\MySnap.snp"
DoCmd.Close acReport, stDocName, acSaveNo

but there is still a print dialog, saying "printing x of x pages".
How can I get rid of that dialog ?

Thanks
0
ee can
Asked:
ee can
  • 7
  • 4
1 Solution
 
ee canAuthor Commented:
Oh yeah and I need to open that generated report afterwards too, in the snapshot viewer, what would be code ???
Thanks
0
 
harfangCommented:
Hello motabobo

If you want totally silent output, change the query of the report so that it includes the criteria, for example, if the form you are running this from is called frmMyForm, then use this as criteria for the field IDCategory:

    Forms!frmMyForm!IDCategory

You can then delete the lines DoCmd.OpenReport and DoCmd.Close acReport alltogether.

Hope this helps!

(°v°)
0
 
harfangCommented:
Oh, yeah:

    FollowHyperlink "C:\MySnap.snp"

(°v°)
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
rockiroadsCommented:
the argument after the filename is AutoStart

DoCmd.OutputTo acOutputReport, stDocName, "Snapshot Format", "C:\MySnap.snp", TRUE

If u pass in true, it automatically starts the application
0
 
harfangCommented:
Good point, rockiroads!
(°v°)
0
 
ee canAuthor Commented:
Thanks for the answers. However the activeX is already placed on the form, I want the viewer to be in the form, not in another window ! Any thoughts ?
Thanks
0
 
harfangCommented:
motabobo,

    acxSnapshotViewer.Object.SnapshotPath = "C:\MySnap.snp"

or

    Dim snp As SnapshotViewer
    Set snp = acxSnapshotViewer.Object
    snp. ' etc... the methods/properties list appears!

Cheers!
(°v°)
0
 
ee canAuthor Commented:
ok how to make it silent now ?
0
 
harfangCommented:
did you try {http:#16786980}?
(°v°)
0
 
ee canAuthor Commented:
what would be the complete line of the DoCmd.OutputTo then ??
0
 
harfangCommented:
0
 
harfangCommented:
However, I tried, and the "printing..." box appears. Not easy to hide, and also a very bad idea to even try. If you feel adventurous (and if you don't mind leaving your users in the dark), you can do this: guaranteed 100% silent, just freezing up the application...

    With New Access.Application
        .OpenCurrentDatabase CurrentDb.Name
        .DoCmd.OutputTo ...
        .CloseCurrentDatabase
        .Quit
    End With

But in that case, your criteria will not work. You will have to use to rewrite the query on which the report is based from code, to include your  WHERE condition. Also, your  database will have to be open in shared mode.

A similar idea would be to have another database, linking  to the sames tables, with only the report and the query. You could then rewrite the query in that database, output the report and close (all in a hidden instance of access).

The more I think about (and try out) your idea, the less I like it. As a user, I prefer 1000 times to see the "printing" message than having a frozen application. But of course, it's your call!

Cheers!
(°v°)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now