Microsoft KB Archive/96101

= ACC: Using dBASE-Style REPORT FORM Command in Code =

Article ID: 96101

Article Last Modified on 1/18/2007

-

APPLIES TO


 * Microsoft Access 1.0 Standard Edition
 * Microsoft Access 1.1 Standard Edition
 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q96101



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



SUMMARY
This article shows you how to implement a dBASE-style REPORT FORM command in Visual Basic for Applications (or Access Basic in versions 1.x and 2.0).



MORE INFORMATION
In dBASE, you can create a report with the Report Generator, and then print the report from a program by using the REPORT FORM TO PRINT command. In Microsoft Access, you can print a pre-existing report programmatically by using DoCmd.OpenReport (or DoCmd OpenReport in versions 1.x and 2.0).

For example, suppose you have created a report in Microsoft Access called MyReport, and you want to print the report from a Visual Basic procedure. Use the following command to do this.

NOTE: If you are using Microsoft Access version 2.0 or earlier, replace &quot;DoCmd.OpenReport&quot; with DoCmd OpenReport in the following examples. DoCmd.OpenReport &quot;MyReport&quot;

If you omit the TO PRINT clause, which is optional in dBASE's REPORT FORM command, the report will be 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 A_PREVIEW parameter: DoCmd.OpenReport &quot;MyReport&quot;, A_PREVIEW In addition, you can open a report in Design view by using the A_DESIGN parameter: DoCmd.OpenReport &quot;MyReport&quot;, A_DESIGN

Keywords: kbhowto kbprint kbprogramming KB96101

-

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

© Microsoft Corporation. All rights reserved.