Multiple instances of a form that has a subform

J

Jose Nuñez

Is it possible to open multiple instances of a form which have a subform?

For example, I tried to open multiple instances of the form Orders in the
Northwind database and it was not possible.

Thanks.
Regards.
José Nuñez
Montevideo
 
D

Dan Artuso

Hi,
This will show you how:
http://support.microsoft.com/?kbid=210248

However, if you need to keep track of the instances, you will have to
implement a collection of these objects perhaps using the caption
(which you would make unique when you create the instance)
as an identifier.
 
J

Jose Nuñez

This is right to work with forms that haven't a subform. But, if the form
has a subform the form is opened and then closed quikly.

Regards.
José Nuñez
Montevideo
 
J

John Vinson

Is it possible to open multiple instances of a form which have a subform?

I'm wondering if this is the best way to accomplish whatever you're
trying to do; it seems like a complex environment for the user. What
are the form and subform's record sources? Are the different instances
of the form attempting to edit the same records? Might it not be
better to dynamically change the filter or recordsource of a single
form?

John W. Vinson[MVP]
 
D

Dan Artuso

Hi,
I can't reproduce that behavior.
I tried it with a form that contains a subform and it works as expected.
The behavior you describe *sounds like* your form variable going out of scope.
Is that possible?
 
J

Jose Nuñez

I've a simple test on the Microsoft's database sample
("NorthwindReports.mdb").

I write the following simple function:

Public Function MULTIPLE()
Dim FRM01 As Form

Set FRM01 = New Form_Orders
FRM01.SetFocus

End Function

I call this function from a macro. The form is shown just an instant and
it's closed.

Regards.
José Nuñez
 
J

Jose Nuñez

For example, it is possible that a user is working with an Order form and he
wants to open another Order form to view some information.
This it is also necessary to give to users the posibility to have opened
more than one form in order to compare information.

Regards.
José Nuñez
 
D

Dan Artuso

Hi,
Yes, your FRM01 variable is destroyed (it goes out of scope) when the function has completed
and so your form closes.
You have to make it a global variable if you want to use it this way.
 
D

Dan Artuso

Hi,
As well, please read the sample code again from the link I posted.
You will see that the form variable is declared in the 'Declarations' section
therefore it stays in scope after the sub or function executes.
 
Top