Hi Debbie.
(1st a pet peeve: ie stands for the latin,
id est, which means, "that is." Eg stands for the latin
exempli gratia, which literally means "example given," which in English is, "For example." You (I'm sure) meant eg, instead of ie.)
You cannot do what it is that you have laid out here, but you can do something that produces the type of results that you seem to be indicating.
If you make a generic form, with a control named heading1, a control named heading2, etc., then you can create an object of that class, and treat it as you have indicated.
Let me back up, and fill in that forms are specialized classes. In many ways they behave exactly like classes. You can create a variable of the type of the form, just as with any class.
Let's say you have a form "frmYuh." You can
Code:
Dim frm as New frmYuh
Additionally, you can add your own properties to a form module, and they will be properties of the form object instantiated from it.
Code:
Option Explicit
Private MyName As string
Public Property Let InstName(Name As String)
MyName = Name
End Property
Public Property Get InstName() As String
If InstName = "" Then
InstName = "<I have no name...>"
Else
InstName = MyName
End If
End Property
Then, when an instance of this class is created, you can address that property
Code:
frm.InstName = "gActiveForm"
There is no way to find this object though...
But you can make an array
Code:
Dim frms() As frmYuh
Then, when you want to create a new one, ReDim the array (with Preserve...), and add your new form instance. When it is time to find it, loop through the array looking at the .InstName property, till you find the one you are after.
If you close one of them
there will be a gap in the array...
You might want to use a Collection object instead. Then you can use the .Key property directly to access your form instances.
Does that help?