Microsoft KB Archive/109395

{|
 * width="100%"|

ACC1x: Description of CreateForm and CreateReport Functions

 * }

Q109395

-

The information in this article applies to:


 * Microsoft Access versions 1.0, 1.1
 * Microsoft Access Distribution Kit, version 1.1

-

SUMMARY
This article describes the CreateForm and CreateReport functions that are documented in the "The Secrets of Access Wizards" manual which is included with the Microsoft Access Distribution Kit.

MORE INFORMATION
This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information on Access Basic, please refer to the "Introduction to Programming" manual.

CreateForm, CreateReport Functions --

Description  Creates a new form or report and returns a form or              report object.

Syntax       CreateForm([database [,formtemplate]])

CreateReport([database [, reporttemplate]])

Remarks      The CreateForm and CreateReport functions use the following arguments:

Argument        Description database        String expressions identifying the name of the database that contains the form or report template; if the argument is                              omitted, the current user database (the                               same value as returned by the CurrentDB                               function) is used.

formtemplate,   String expression identifying the name reporttemplate  of the form or report template, the name of a form or report, or the word Normal. If the expression is omitted, Access Basic uses the form or report template set with the Options command on the View menu.

These functions are the equivalent of choosing New Form and New Report from the File menu in the Database window. They return a form or report object. Use these functions in Design Mode only.

Example      Creates a report in the user database using the Normal template.

Sub NormalReport Dim MyReport As Report ' CreateReport function creates a minimized report ' that we need to restore. Set MyReport = CreateReport("","") DoCmd Restore End Sub