473,480 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Opening multiple instances of a form in A2K: Gotchas?

I know I can open many instances of a given form, but I've never done it.

Now I'm analyzing an application where that seems like just the ticket: Many
investment funds, *lots* of data points for each fund, and a desire by the users
to see several funds presented side-by-side.

Is opening, say, five instances of the same form real-world-doable?
--
PeteCresswell
Nov 13 '05 #1
12 3196
Pete,

What do you have to do to get the forms to appear side-by-side? How does one
open multiple instances - DoCmdOpenForm "MyForm" several times?

Thanks,

Julie
"(Pete Cresswell)" <x@y.z> wrote in message
news:3e********************************@4ax.com...
I know I can open many instances of a given form, but I've never done it.

Now I'm analyzing an application where that seems like just the ticket: Many investment funds, *lots* of data points for each fund, and a desire by the users to see several funds presented side-by-side.

Is opening, say, five instances of the same form real-world-doable?
--
PeteCresswell

Nov 13 '05 #2
RE/
What do you have to do to get the forms to appear side-by-side? How does one
open multiple instances - DoCmdOpenForm "MyForm" several times?


I *think* you declare a variable and then instantiate into the variable.

Something like:
----------------------------------------
Dim myForm As Form

Set myForm = New Form_frmHelloWorld
----------------------------------------

But, frankly, I can't make it work.....

http://support.microsoft.com/default...b;en-us;135369

and

http://support.microsoft.com/default...b;en-us;210248

look pretty much the same...but...
--
PeteCresswell
Nov 13 '05 #3
Hi, Pete.
Dim myForm As Form

Set myForm = New Form_frmHelloWorld
----------------------------------------

But, frankly, I can't make it work.....
Form_frmHelloWorld refers to the module of the form. Make sure that the
form's HasModule Property is set to Yes, even if it doesn't have any code
already typed in the form's module.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
"(Pete Cresswell)" <x@y.z> wrote in message
news:g7********************************@4ax.com... RE/
What do you have to do to get the forms to appear side-by-side? How does oneopen multiple instances - DoCmdOpenForm "MyForm" several times?


I *think* you declare a variable and then instantiate into the variable.

Something like:
----------------------------------------
Dim myForm As Form

Set myForm = New Form_frmHelloWorld
----------------------------------------

But, frankly, I can't make it work.....

http://support.microsoft.com/default...b;en-us;135369

and

http://support.microsoft.com/default...b;en-us;210248

look pretty much the same...but...
--
PeteCresswell

Nov 13 '05 #4
Opening instances is easy, with the New keyword.

The interesting part is managing the instances so they are independent of
each other. Typically that means creating a custom collection and appending
the instances. There's a downloadable example in:
Managing Multiple Instances of a Form
at:
http://members.iinet.net.au/~allenbrowne/ser-35.html

Once you get that working, you may need to change the way you do some other
things as well. If you have 5 instances of the same form open, the Forms
collection will contain 5 members with the same name. That means you cannot
use a references like:
Forms!Form1!Textbox1
in your code or in the Criteria of a query, because that may not refer to
the instance you intend.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"(Pete Cresswell)" <x@y.z> wrote in message
news:3e********************************@4ax.com...
I know I can open many instances of a given form, but I've never done it.

Now I'm analyzing an application where that seems like just the ticket:
Many
investment funds, *lots* of data points for each fund, and a desire by the
users
to see several funds presented side-by-side.

Is opening, say, five instances of the same form real-world-doable?
--
PeteCresswell

Nov 13 '05 #5
RE/
Once you get that working, you may need to change the way you do some other
things as well. If you have 5 instances of the same form open, the Forms
collection will contain 5 members with the same name. That means you cannot
use a references like:
Forms!Form1!Textbox1
in your code or in the Criteria of a query, because that may not refer to
the instance you intend.


Which brings me back to the original question: is this a "real-world-doable"
thing or just a theoretical capability? i.e. Do I want to embrace multiple
instances of the same form as a solution or look for some other way to
accomplish the same end?
--
PeteCresswell
Nov 13 '05 #6
Pete, for forms, it is a real world solution.
Not sure about reports, but it is for forms.

Just do it with your eyes open, i.e. trying to give you a heads up on the
things you need to do differently.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"(Pete Cresswell)" <x@y.z> wrote in message
news:nf********************************@4ax.com...
RE/
Once you get that working, you may need to change the way you do some
other
things as well. If you have 5 instances of the same form open, the Forms
collection will contain 5 members with the same name. That means you
cannot
use a references like:
Forms!Form1!Textbox1
in your code or in the Criteria of a query, because that may not refer to
the instance you intend.


Which brings me back to the original question: is this a
"real-world-doable"
thing or just a theoretical capability? i.e. Do I want to embrace
multiple
instances of the same form as a solution or look for some other way to
accomplish the same end?
--
PeteCresswell

Nov 13 '05 #7
Allen Browne wrote:
Pete, for forms, it is a real world solution.
Not sure about reports, but it is for forms.


I went so far as to handle button events (for buttons I want on many
forms) from a class module I wrote for that purpose. It is to be found
on my site, it is called IFObjects.

All written using A97 but I hardly think that is an issue here.

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #8
Bri
Pete,

I did this by declaring a Public Form variable as an array. Then each
time I create a new form I can grab the UBound of the variable, ReDim it
up by one, use the Set with New to open the new instance. This way each
form has its own Form variable that can be used for referencing it (or
itself). You have to use a new variable or an element of an array
variable because otherwise if the variable goes out of scope the form
will close. When the Form instance closes you can set the variable array
element to nothing. You can set a form module level variable to hold the
local reference to the array variable to make this easier.

Hope this helps.

__
Bri

(Pete Cresswell) wrote:
RE/
Once you get that working, you may need to change the way you do some other
things as well. If you have 5 instances of the same form open, the Forms
collection will contain 5 members with the same name. That means you cannot
use a references like:
Forms!Form1!Textbox1
in your code or in the Criteria of a query, because that may not refer to
the instance you intend.

Which brings me back to the original question: is this a "real-world-doable"
thing or just a theoretical capability? i.e. Do I want to embrace multiple
instances of the same form as a solution or look for some other way to
accomplish the same end?

Nov 13 '05 #9
RE/
Just do it with your eyes open, i.e. trying to give you a heads up on the
things you need to do differently.


Thanks. Your example was valuable.
--
PeteCresswell
Nov 13 '05 #10
"(Pete Cresswell)" <x@y.z> wrote in
news:nf********************************@4ax.com:
RE/
Once you get that working, you may need to change the way you do
some other things as well. If you have 5 instances of the same
form open, the Forms collection will contain 5 members with the
same name. That means you cannot use a references like:
Forms!Form1!Textbox1
in your code or in the Criteria of a query, because that may not
refer to the instance you intend.


Which brings me back to the original question: is this a
"real-world-doable" thing or just a theoretical capability? i.e.
Do I want to embrace multiple instances of the same form as a
solution or look for some other way to accomplish the same end?


Check out the ADH chapter on this. They set up a custom collection
to manage your form instances, and then you access the form
instances through that collection. I've done it and it works -- it's
a triviality.

However, I don't think this kind of thing is needed very often.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #11
Allen, you may be amused to see how I used your multiple instance code. I
do not think there is much use in multiple instances in this database, but I
did it just for fun. Database is at
http://www.psci.net/gramelsp/Naturalizations_test.zip and is only 82 KM when
zipped (Access 2000).
It is possible to open multiple instances of forms all with different record
sources. It is your code, which I, so-to-speak, stole. Anyway, they say
that imitation (theft) is the sincerest form of flattery.

Mike
Nov 13 '05 #12
Great: glad it helped.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mike Gramelspacher" <gr******@psci.net> wrote in message
news:cn**********@pscinews.psci.net...
Allen, you may be amused to see how I used your multiple instance code. I
do not think there is much use in multiple instances in this database, but
I did it just for fun. Database is at
http://www.psci.net/gramelsp/Naturalizations_test.zip and is only 82 KM
when zipped (Access 2000).
It is possible to open multiple instances of forms all with different
record sources. It is your code, which I, so-to-speak, stole. Anyway,
they say that imitation (theft) is the sincerest form of flattery.

Mike

Nov 13 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
1973
by: MLH | last post by:
My alzheimer moments occur with greater frequency these days, it seems. I sometimes open Access and the same dbase in a second instance and work on items. If I modify a form and discover later...
11
20861
by: Clark Stevens | last post by:
I just finished a WinForms app in VB.NET. I want to allow the user to be able to run multiple instances of the program like you can with Notepad and Wordpad. The way it is now, once I run the...
1
3441
by: Vivek | last post by:
Hi, I am developing a MDI application. I need to track the child forms open so that I can stop a user from opening the multiple instances of the same child form. Now what is the best way of...
4
3261
by: GGerard | last post by:
Hello I have a program where the user can open as many instances of a form as the user wants. The only limit to how many instances can be opened is determined by the limit of the computer...
3
7675
by: sara | last post by:
I've been reading all the posts on this topic. Most are years old, so I have 2 questions: 1. Is there any improvement on opening the same report multiple times (with different input parameters...
11
12777
by: Tony K | last post by:
I have a MDI application. On the menu toolstrip child forms are selected from one of the menus. I don't want to play the disable/enable menu item game. I have selected that open forms are added...
1
1515
by: ncjed | last post by:
First off, my apologies if this topic has previously been covered. I am in the process of creating an A2K DB (Win XP) that will open other DBs (either on local drive, mapped drives, or UNC network...
3
1630
by: VB4DUMMYPOSTERCHILD | last post by:
Hi, this is my first time posting a question so please bear with me. I am a novice at VB2005 and looking for help utilizing a variable to call open a database. This will allow me to chose which...
10
1911
by: ajaybathla | last post by:
I have two different versions of a tool. Opening an instance of that tool using PHP works absolutely fine but, when i try to open another instance with different version of the same tool, with this...
0
7037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6732
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4768
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4472
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2990
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1294
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
174
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.