ACC: Using dBASE-Style REPORT FORM Command in CodeLast reviewed: August 29, 1997Article ID: Q96101 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. This article discusses 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 INFORMATIONIn dBASE, you can create a report with the Report Generator and then print the report from a program using the REPORT FORM TO PRINT command. In Microsoft Access, you can print a pre-existing report programmatically 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 accomplish this: NOTE: If you are using Microsoft Access version 2.0 or earlier, replace "DoCmd.OpenReport" with "DoCmd OpenReport" (without the quotation marks) in the following examples.
DoCmd.OpenReport "MyReport"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 "MyReport", A_PREVIEWIn Addition, you can open a report in Design view by using the A_DESIGN parameter:
DoCmd.OpenReport "MyReport", A_DESIGN Keywords : kbprg kbprint PgmOthr Version : 1.0 1.1 2.0 7.0 97 Platform : WINDOWS Hardware : x86 Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |