user1912657
user1912657

Reputation: 189

Creating form from template with VBA in Access

I'm using this row to create a form from a template in MS Access:

Set frm = CreateForm(, "MallFrm")

The MallFrm contains buttons but these buttons don't appear in the new form.

How to get buttons created in a new form from the template form?

Upvotes: 1

Views: 1629

Answers (1)

HansUp
HansUp

Reputation: 97101

When you create a new form based on a template form, the new form inherits style properties from the template but does not copy control objects from the template.

For your purpose, use DoCmd.CopyObject to create a copy of the template and continue your design work using the copy.

DoCmd.CopyObject NewName:="NewForm", SourceObjectType:=acForm, SourceObjectName:="MallFrm"
DoCmd.OpenForm FormName:="NewForm", View:=acDesign
Set frm = Forms!NewForm

Upvotes: 3

Related Questions