Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: How to Implement a dBASE-Style REPORT FORM Command in Visual Basic for Applications


View products that this article applies to.

This article was previously published under Q210576
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

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

↑ Back to the top


Summary

This article demonstrates how to implement a dBASE-style REPORT FORM command in Visual Basic for Applications.

↑ Back to the top


More information

In dBASE, you create a report with the Report Generator, and then print the report from a program with the REPORT FORM TO PRINT command. In Microsoft Access, you print a pre-existing report programmatically with DoCmd.OpenReport.

For example, suppose that you created a report in Microsoft Access named MyReport, and you wanted to print the report from a Visual Basic procedure. You would run the following command to do this:
DoCmd.OpenReport "MyReport"
				
If you omit the TO PRINT clause, which is optional in dBASE's REPORT FORM command, the report is printed to the screen. This is equivalent to showing the report in Print Preview mode, rather than sending it to the printer. This can be done with DoCmd.OpenReport by adding the acViewPreview parameter:
DoCmd.OpenReport "MyReport", acViewPreview
				
In addition, with the acViewDesign parameter, you can open a report in Design view:
DoCmd.OpenReport "MyReport", acViewDesign
				

↑ Back to the top


Keywords: KB210576, kbprogramming, kbprint, kbhowto

↑ Back to the top

Article Info
Article ID : 210576
Revision : 4
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 368