Application.CreateReport method (Access)

The CreateReport method creates a report and returns a Report object. For example, suppose you are building a custom wizard to create a sales report. Use the CreateReport method in your wizard to create a new report based on a specified report template.

Syntax

expression.CreateReport (Database, ReportTemplate)

expression A variable that represents an Application object.

Parameters

Name Required/Optional Data type Description
Database Optional Variant The name of the database that contains the report template that you want to use to create a report. If you want the current database, omit this argument. If you want to use an open library database, specify the library database with this argument.
ReportTemplate Optional Variant The name of the report that you want to use as a template to create a new report.

Return value

Report

Remarks

Use the CreateReport method when designing a wizard that creates a new report.

The CreateReport method open a new, minimized report in report Design view.

If the name that you use for the ReportTemplate argument isn't valid, Visual Basic uses the report template specified by the Report Template setting on the Forms/Reports tab of the Options dialog box.

Example

The following example creates a report in the current database by using the template specified by the Report Template setting on the Forms/Reports tab of the Options dialog box.

Sub NormalReport() 
 Dim rpt As Report 
 
 Set rpt = CreateReport ' Create minimized report. 
 DoCmd.Restore ' Restore report. 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.