[AccessD] Multiple Form Instances

John Skolits askolits at ot.com
Mon Oct 9 21:12:28 CDT 2006


I think that all makes pretty good sense.

But, will I have to actually design the new form from scratch through code?

My plan was to just grab an existing form and open it up many times just
changing the recordsource for each instance.

John




-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil
Salakhetdinov
Sent: Monday, October 09, 2006 7:31 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Multiple Form Instances

John,

You cannot refer to such form instances by name - you have to use indexes in
global Access.Application.Forms collection or in your custom collection if
you put form's instances object references in it as I have shown in the
code. BTW, you HAVE to put form instance's object reference somewhere after
you open it "object way" (as shown in the code) otherwise it will be closed
immediately after your code leaves the sub/function where form is opened
this object way except the case when your form is modal - for this latter
case your code will "get stuck" at the point:

frm.visible = true

If you wanted to refer to your forms' instances using mnemonic names like
e.g:

- PriceByDefectiveMaterialForm
- PriceByDefectiveSolderForm
- PriceByDefectiveWiringForm
- ...

Then you can use these mnemonic names while putting forms' instances object
refs into collection:

col.add frm, "PriceByDefectiveMaterialForm"
....

... and then somewhere in other part of your code ...
Set frm = col("PriceByDefectiveMaterialForm")

etc.

Of course col collection should be (custom class) module level variable...

--
Shamil
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Skolits
Sent: Tuesday, October 10, 2006 1:52 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Multiple Form Instances

Then can I refer to the form object"frm" to set it's individual properties?

Is there a way to then name that form object in case I have a few open and
want to make change in one particular form?

Or will they just be enumerated frm(0), frm(1) etc?

John


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil
Salakhetdinov
Sent: Monday, October 09, 2006 5:49 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Multiple Form Instances

Yes, John, you can have multiple form instance opened at once - just make
sure they have a form module or HasModule property set to true and then use
(let's say your form's name is myForm):

Dim col as new collection
Dim frm as new myForm

col.add frm
frm.visible = true

Similar way multiple instances of reports can be opened.


--
Shamil
 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Skolits
Sent: Tuesday, October 10, 2006 1:30 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Multiple Form Instances


I think there is a way to do this.

Can I have multiple instances of the same form.

I have form with a chart on it. I want to show multiple instances of this
same form but I'll provide a different data source for the chart.

This way if I need to do:

Price By Defective Material
Price by Defective Solder
Price By Defective Wiring
....

(About 20 options) 

I don't need 20 forms.
I still want to give them the ability to have any number on the screen at
the same time.

I'm also guessing if I can do this forms, I should be able to do this with
reports as well.

John



-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list