Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open multiple instance of the same form

Status
Not open for further replies.

striker73

MIS
Jun 7, 2001
376
US
Is there any way to open multiple instances of the same form? I have tried the following code on frmMyForm:

Dim frm as Form
Set frm = New Form_frmMyForm
frm.Visible = True

...which looks like it opens a new instance of the form, and flashes it on the screen for a second and then the form disappears. Any ideas on how I can do this successfully? Thanks!
 
'You need to add a container for the forms.
' the following is for DAO VBA coding:
'================
'In the form-level module declaration area, add the following:

Dim colforms as New Collection

' colforms can be any name you choose for the collection
'=================

' now reference the collection in the sub:

Private Sub whatever_click(Cancel As Integer)
Dim frm as Form
Set frm = New Form_frmMyForm
frm.Visible = True
colforms.Add frm

End Sub
'===============
' this allows the form instances' lifetime to equal the calling form's life.
' make sure frmMyForm.PopUp = Yes

'Hope this helps.
'Preston
 
When I try to add the form to the form collection, I get the following error: "Object variable or With block variable not set." What does this mean?
 
Maybe this is too much of a hassle. My client wants to be able to view mulitple copies of the same window, but as I'm thinking about it, it sounds like it's going to get exponentially complicated if I allow this. I'm trying to think of a work-around. [neutral]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top