I agree this seems like a no-brainer, but it’s not. All subform names that need to be displayed has to be known when the form opens. Hide-Refresh formulas have no effect. The way I have dealt with this is to have a compose script that prompts the user for a keyword, creates the document and saves it to disk, then displays it to the user in edit mode. When this is done, the proper subform displays.
This is a tiny code snippet with no detail on how I prompt the user. Let me know if you need more. A forumula solution follows this code.
Dim workspace As New NotesUIWorkspace
Dim session As New notessession
Dim db As notesdatabase
Dim doc2 As notesdocument
Set doc2 = db.CreateDocument
‘Prompt for keyword value
‘set keyword value that controls subform selection
doc2.form = “MainDocument”
Call doc2.save(True, True)
Set uidoc = workspace.EditDocument(True, doc2)
Another way that I’ve made this work using formula is to give the user a form button that they click, prompt for a value, then end with a switch form to the same form name. This seems to work as well.
Rem “Code to prompt user for a value that subform will use to display”;
Rem “set the keyword field value selected”;
@PostedCommand( [ViewSwitchForm] ; “MainDocument” )