I have several times had the need to incorporate different computed subforms based on what kind of input the user supplies. In order to accomplish this I have used an "initial" entry form, collecting the necessary data to determine what subforms to use. This initial form has SaveOption set to "0" and in a button I construct the "real" form to be used. The fields that determine what subform to be used are filled and the new form is then presented to the user.
Things to take into account:
- The new document is never "New"; it's created in the background
- If the new form has computed fields they are not computed automatically; they have to be calculated.
'Collect data from "initial" forms uidoc
'Create new document
Set doc = db.CreateDocument
doc.form = "newform"
'Collect info from "initial" form
'Determine subform to use
documenttype =..... something
doc.subform = DetermineSubform(documenttype)
'Show new form with correct subform to user
Set uidoc = ws.Editdocument(True,doc,False)