Microsoft KB Archive/307184

= ACC97: How to Use Visual Basic for Applications to Export a Report in Snapshot Format =

Article ID: 307184

Article Last Modified on 1/31/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q307184



Moderate: Requires basic macro, coding, and interoperability skills.



SUMMARY
This article shows you how to use Visual Basic for Applications (VBA) code to export a Microsoft Access report in Snapshot format.



MORE INFORMATION
With Microsoft Access 97 Service Release 1 and Microsoft Office 97 Service Release 1, you can save a static picture of a Microsoft Access report in an external file format (*.snp). You can then make the report available to users who do not have Microsoft Access installed on their computers. For example, you can send the report in e-mail or copy it to a user's hard disk. The user has to have only Microsoft Snapshot Viewer to view the report.

If you have Microsoft Access 97 Service Release 1 or Microsoft Office 97 Service Release 1 on compact disc (CD), you can find Snapshot Viewer at the following location on the CD:

ValuPack\Access

Snpvw80.exe is a self-extracting file that installs Snapshot Viewer. Double-click the Valupk8.hlp file on your CD (located in the ValuPack folder) for information about how to install ValuPack features, including Snapshot Viewer.

For an example of how to use Visual Basic for Applications to export a Microsoft Access report in Snapshot format, follow these steps:

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

 Open the sample database Northwind.mdb. Create a new form in Design view. Make sure that the Control Wizards button in the toolbox is not turned on. Add a command button to the form. Right-click the command button, and then click Properties. Click the All tab.</li> Change the Caption property to Export Report as SNP .</li> Close the property sheet.</li> Right-click the command button, and then click Build Event.</li> In the Choose Builder dialog box, click Code Builder, and then click OK.</li>  Type or paste the following code: On Error Resume Next

Dim stDocName As String

stDocName = &quot;Sales by Category&quot; DoCmd.OutputTo acReport, stDocName, &quot;SnapshotFormat(*.snp)&quot;, &quot;&quot; </li> On the File menu, click Close and Return to Microsoft Access to return to the form.</li> View the form in Form view.</li> Click the command button.</li> In the Output To window, select the folder to which you want to save the report.</li></ol>

The report is saved as a Snapshot file. You can open the file without opening Microsoft Access if you have Snapshot Viewer installed.

Additional query words: inf Snapshot Format Export Report

Keywords: kbhowto KB307184

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.