473,833 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
+ 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 3242
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.c om...
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_frmHelloWo rld
----------------------------------------

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_frmHelloWo rld
----------------------------------------

But, frankly, I can't make it work.....
Form_frmHelloWo rld 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.c om... 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_frmHelloWo rld
----------------------------------------

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!Tex tbox1
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.c om...
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!Tex tbox1
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.c om...
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!Tex tbox1
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!Tex tbox1
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

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

Similar topics

11
2008
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 that I'm working in a 2nd instance of Access, I close it. The modifications are not present in the first instance of the program and I have to make them again. Is there a setting I can make that will prevent me from inadvertently doing just that?
11
21016
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 executable I can not run another instance as long as the first instance is running. How can I change this behavior? Thanks.
1
3468
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 achieving it. I tried using an Forms Array but is not the most efficient way. I think I can create a collection but then how do I create a global collection that can be accessed from all the forms. Please help. Thanks
4
3297
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 itself (the amount of RAM - I think). When enough instances of this form are opened and the limit of the computer is reached
3
7702
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 on each) with Access 2000? 2. In the post listed below (from March 1998) M G Foster posed a solution that makes sense to me and looks like something I could learn. HOWEVER, the code snippet refers to getting the input parameters from a list...
11
12825
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 to the "Window" menu item. What I'm looking for is when the user clicks on the menu item to open the form, how can I check to see if it's open already and if so then set the focus (if possible). What happens now is if the menu item is clicked...
1
1535
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 path). My current goal is to open all forms from the target DB, read through the controls, and if the length of the control's property is > 0 (eliminate nulls and blanks), write the value out to a table on my local DB. I am using the...
3
1653
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 access database (with similar tables) I want to open utilizing the same form. I currently do this in VB6. I can open multiple instances of the same or different databases as an mdichild inside a parent form. I have not found out how to do this in...
10
1938
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 version already in place there comes the error. This is not the same GUI as is desired.Also, this version when opened independently works fine. So, the problem is with the access of multiple instances of this tool using PHP.Kindly suggest.
0
10500
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10213
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9323
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7753
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4422
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 we have to send another system
2
3972
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3078
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.