Is this possible?

  • Thread starter Thread starter JString
  • Start date Start date
Is it possible to programatically create a new form using another as a
template?

Sure. Just copy the existing form and change it's record source and
other changes (if you wish).

' Copy the existing form
DoCmd.CopyObject , "NewFormName", acForm, "OldFormName"

' Change it's record source to a different one.
DoCmd.OpenForm "NewFormName", acDesign, , , , acHidden
Forms!NewFormName.RecordSource = "NewRecordSource"
' Make additional form changes here.... then....
DoCmd.Close acForm, "NewFormName", acSaveYes

' Open the new form
DoCmd.OpenForm "NewFormName"
 
Back
Top