|
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 | |
Share:
|
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 | | |
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 | | |
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 | | |
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 | | |
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 | | |
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 | | |
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 | | |
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? | | |
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 | | |
"(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 | | |
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 | | |
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
| | This discussion thread is closed Replies have been disabled for this discussion. Similar topics
11 posts
views
Thread by MLH |
last post: by
|
11 posts
views
Thread by Clark Stevens |
last post: by
|
1 post
views
Thread by Vivek |
last post: by
|
4 posts
views
Thread by GGerard |
last post: by
|
3 posts
views
Thread by sara |
last post: by
|
11 posts
views
Thread by Tony K |
last post: by
| | | | | | | | | | | | | |