Dim f As Form
Set f = CreateForm
With f
.AutoResize = True
.AutoCenter = True
.Caption = "My Form"
.CloseButton = True
.MinMaxButtons = False
.PopUp = True
' and whatever other props you want to set
End With
Dim b As CommandButton
Set b = CreateControl(f.Name, acCommandButton, acDetail)
With b
.Width = 2440
.Height = 500
.Visible = True
.Caption = "my button"
' and whatever other props you want
End With
DoCmd.OpenForm f.Name, acNormal, , , , acDialog