• Printing a Snapshot report from VBA (Access97/SR1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Printing a Snapshot report from VBA (Access97/SR1)

    Author
    Topic
    #357617

    Can someone help me with the necessary code to print a snapshot report from code within Access.

    I have several reports that are generated by an offsite facility that I want to include in a set of reports that I am distributing. I am looking for a way to have a piece of code print the report without any user intervention.

    Viewing 0 reply threads
    Author
    Replies
    • #531639

      Basically, your code needs to look like this:

      DoCmd.OutputTo acOutputReport, strReportName, “Snapshot Format”, strFilePath

      • #531657

        I can’t seem to get this to work. Does Access97 support the OutputTo with a format of Snapshot? Every help file I looked at doesn’t list it as an available intrinsic constant. However, I see it (acFormatSNP) listed with references to Access2000.

        Any workarounds for Access97?

        • #531671

          You might need the Access97 SR-2 to make this work. That’s what I have, and it recognizes that “Snapshot Format” in the command. You can get SR-2 for free from Microsoft website.

          • #531673

            That is very good news. Why do you say?

            I recently received an upgraded PC here at work (sort of, at least it’s better than what I had) but I noticed that all of the Office 97 components are updated to SR2 except for Access. I have submitted work requests to have Access upgraded to SR2 as well. Hopefully it only takes one full moon.

            I will let you know how it works.

            Thanks for your timely repsonses.

          • #531694

            Can you please use some fake file and path names and show me exactly what you are using. I can’t get it to work, I keep getting a message that says the file name is spelled incorrectly. Also the intrinsic constant of acFormatSNP does not show up on my home PC (Access97/SR2). Are you actually putting “Snapshot Format” in the code or are you using acFormatSNP. confused

            • #531745

              You actually have to use the string “Snapshort Format”, just as I wrote it.

            • #531782

              MarkJ and I had a similar conversation in this thread By using a macro and converting it, I came up with this syntax:
              [indent]


              DoCmd.OutputTo acReport, “rptMyReport”, “SnapshotFormat(*.snp)”, “c:mydocumentsmyreport.snp”


              [/indent] Give it a try and let us know how it works. Hope it helps. smile

            • #531798

              Edited by Charlotte to eliminate horizontal scrolling

              Ok, I finally got it to work using the following code:

              DoCmd.OutputTo acOutputReport, “z0_ME Cover Henderson”, “SnapshotFormat(*.snp)”, “s:PRODUCTIONMisHenderson test.snp”, False, “”

              Thanks to those who helped. BUT, I must have asked the wrong question in the first place. The above situations work great if I need to generate a snapshot from the existing database’s data. In my situation, the data changes from day to day (sometimes hour to hour). An out-of-state sister facility produces their daily reports and places a copy in a network folder in the snapshot format. When I get ready to run my daily reports (hard-copied), I open my database and use a switchboard button to start code that prints off all the necessary reports in the correct order. What I am trying to do, is find way to use the same code that generates my daily (hard-copied) report to also include the snapshot reports from sister facility.

              Does this even sound doable?? At first I thought yes, because Access has the ability to open Excel, open a file, print a specific worksheet, then close Excel. So I naturally assumed doh that this would also be possible with a Snapshot report.

              Here is a sample of the code I am currently using, the blue text is what I need to edit.

              Function Proc__PrintReports()
                  DoCmd.OpenReport "Volume Received - Summary",  _
                           acNormal, "", ""
                  DoCmd.OpenReport "Daily Summary All RCs (modified 041100)",  _
                          acNormal, "", ""
                  DoCmd.OpenReport "MTD Production Summary (modified 041100)",  _
                         acNormal, "", ""
                  DoCmd.OpenReport "YTD Production Summary (modified 041100)",  _
                         acNormal, "", ""
                  DoCmd.OpenReport "CPWU Summary All RCs (modified 041100)",  _
                         acNormal, "", "" 
                  DoCmd.OutputTo acOutputReport, "z0_ME Cover Henderson",  _
                     "SnapshotFormat (*.snp)", "s:PRODUCTIONMisHenderson test.snp",  _
                     False, ""
                  DoCmd.OpenReport "Daily Operator Embossing",  _
                       acNormal, "", ""
                  DoCmd.OpenReport "Daily Operator Match Merge",  _
                        acNormal, "", ""
                  DoCmd.OpenReport "Daily Operator Half Bowe", _
                         acNormal, "", ""
                  DoCmd.OpenReport "Daily Operator Laser Print",  _
                         acNormal, "", ""
                  DoCmd.OpenReport "Daily Operator Tagging",  _
                         acNormal, "", ""
                  DoCmd.OpenReport "Daily Operator Hold",  _
                         acNormal, "", ""
                  DoCmd.OpenReport "Daily Operator Handstuffing",  _
                        acNormal, "", ""
                  DoCmd.OpenReport "Daily Operator Inserting",  _
                        acNormal, "", ""
              End Function
              

              Any thoughts or ideas??

            • #531847

              Steve, looking at your original post, in retrospect your question was pretty clear. My mind on the other hand was a little fuzzy. Unfortunately, I don’t have an answer for you. You may be able to call Snapview.exe with a command line to invoke print, but I’m afraid I don’t know how. There is an ActiveX control available to load snapshot files and once loaded a PrintSnapshot Method is available but again this is a little beyond my abilities. Perhaps this will lead you in the right direction though. The other option of course is to have the data rather than the report transmitted to you. Then you could construct and print the report locally. Sorry, I couldn’t be more help. Good luck.

    Viewing 0 reply threads
    Reply To: Printing a Snapshot report from VBA (Access97/SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: