Application.CreateForm method (Access)
The CreateForm method creates a form and returns a Form object.
Syntax
expression.CreateForm (Database, FormTemplate)
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 form template that you want to use to create a form. 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. |
FormTemplate | Optional | Variant | The name of the form that you want to use as a template to create a new form. |
Return value
Form
Remarks
Use the CreateForm method when designing a wizard that creates a new form.
The CreateForm method opens a new, minimized form in form Design view.
If the name that you use for the FormTemplate argument isn't valid, Visual Basic uses the form template specified by the Form Template setting on the Forms/Reports tab of the Options dialog box.
Example
This example creates a new form in the Northwind sample database based on the Customers form, and sets its RecordSource property to the Customers table. Run this code from the Northwind sample database.
Sub NewForm()
Dim frm As Form
' Create form based on Customers form.
Set frm = CreateForm("Customers")
DoCmd.Restore
' Set RecordSource property to Customers table.
frm.RecordSource = "Customers"
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.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기