Microsoft Access VBA Programming for the Absolute Beginner

Opens a report.

Syntax

DoCmd.OpenReport ReportName[, View][, FilterName][, WhereCondition][, WindowMode][, OpenArgs]

with the following parameters:

ReportName

A String containing the name of the report in the current database.

View

One of the following members of the AcView enumeration: acViewDesign, acViewNormal (prints the report immediately, the default), and acViewPreview.

FilterName

The name of a query in the current database upon which the report will be based.

WhereCondition

A string containing a SQL WHERE clause without the WHERE keyword.

WindowMode

One of the following AcWindowMode constants defining the state of the open window: acDialog (sets the report’s Modal and Popup properties to Yes), acHidden (the report is not visible), acIcon (the report is minimized), and acWindowNormal (the default; the report is opened based on its property settings).

OpenArgs

A value to be assigned to the report’s OpenArgs property. Typically, this is used to take some action in the report’s Load or Open event procedure.

Example

Public Sub PrintCustomerRpt() Dim strReportName As String strReportName = "rptCustomerList" DoCmd.OpenReport strReportName, acViewPreview, , "txtState = 'NJ'" DoCmd.PrintOut acPages, 1, 2 End Sub

Comments

Категории