In MS Access, there are two ways to open a new form:
DoCmd.OpenForm "myForm"- opens the "default instance" of a formSet frm = New Form_myForm : frm.Visible = True- opens a new instance of a form.
I need to use the second option, because I want to open multiple instances of myForm. (If you are unfamiliar with it, more details about this technique can be found here.)
How would I do that if I have the name of the form only available as a string? I.e., I need to write some library method
Sub OpenAnotherInstanceOfForm(ByVal formName As String)
Dim frm As Form ' or Object, late binding is fine for me in this case
Set frm = ... ' <-- What goes here?
frm.Visible = True
... ' Persist the object reference, so that frm stays open. I know how to do that.
End Sub
Here is what I have already tried:
Set frm = CreateObject("Form_" & formName)- Run time error 429Set frm = Eval("New Form_" & formName)- Run time error 2482