OpenReport Method [Access 2003 VBA Language Reference]
The OpenReport method carries out the OpenReport action in Visual Basic.
expression.OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)
expression Required. An expression that returns a DoCmd object.
ReportName Required Variant. A string expression that's the valid name of a report in the current database. If you execute Visual Basic code containing the OpenReport method in a library database, Microsoft Access looks for the report with this name, first in the library database, then in the current database.
|AcView can be one of these AcView constants.|
|acViewNormaldefault Prints the report immediately.|
|acViewPivotChart Not supported.|
|acViewPivotTable Not supported.|
FilterName Optional Variant. A string expression that's the valid name of a query in the current database.
WhereCondition Optional Variant. A string expression that's a valid SQL WHERE clause without the word WHERE.
|AcWindowMode can be one of these AcWindowMode constants.|
|acDialog The form's Modal and PopUp properties are set to Yes.|
|acHidden The form is hidden.|
|acIcon The form opens minimized in the Windows taskbar.|
|acWindowNormaldefault The form is in the mode set by its properties.|
OpenArgs Optional Variant. Sets the OpenArgs property.
For more information on how the action and its arguments work, see the action topic.
The maximum length of the WhereCondition argument is 32,768 characters (unlike the Where Condition action argument in the Macro window, whose maximum length is 256 characters).
You can leave an optional argument blank in the middle of the syntax, but you must include the argument's comma. If you leave one or more trailing arguments blank, don't use a comma following the last argument you specify.
The following example prints Sales Report while using the existing query Report Filter.
DoCmd.OpenReport "Sales Report", acViewNormal, "Report Filter"
Applies to | DoCmd Object