• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 386
  • 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
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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