Hey all,
I got it. We can create dynamic user form as follows:
1. Ensure that the subform is not opened with the main form.
(me.subform.SourceObject="")
2. Open the subform in design view:
DoCmd.OpenForm msub_name, acDesign, , , acFormEdit, acHidden
3. Delete unnecessary controls from the subform
Call DeleteControl(msub_name, mcont.name)
4. Use the createcontrol function to add the necessary controls
5. Save the subform
DoCmd.Close acForm, msub_name, acSaveYes
6. In the main form, restore the sourceobject property of the subform
|