Is there a way to specify that selecting a Switchboard option (that brings up a form) creates another instance of that form v. changing focus to the existing one?
How to create multiple instances of the same form?
Collapse
X
-
Opening Multiple Instances of a Form can be a little tricky. This Demo should help you out.Attached Files -
Thanks for this. A couple of questions:
I'm assuming that the code in OpenAClient is what I'd need to implement? What is the purpose of the collection mentioned in that code? The names are a little cryptic, so I feel very uncertain about understanding the implications of what's going on in that module. What does a "caption" do for me?
Also, why is there a special module to close forms? Why can't the user just close whichever instance they want to?Comment
-
Correctamundo!I'm assuming that the code in OpenAClient is what I'd need to implement?
To hold and manage the various Form Instances.What is the purpose of the collection mentioned in that code?
All Instances of a Form are exactly the same as far as Name goes, so the Caption is a method of telling one from another.The names are a little cryptic, so I feel very uncertain about understanding the implications of what's going on in that module. What does a "caption" do for me?
Yep, the User can manually Close an Instance he/she wants to.Also, why is there a special module to close forms? Why can't the user just close whichever instance they want to?Comment
-
The Switchboard Item calls the Public OpenAClient() Function.
P.S. - See Attachment.Attached FilesComment
-
I copied and pasted that code into my module (changing the name of the form to match mine) and added it to my Switchboard, but when I tried to execute it, the screen inside my Access window flashed (as though it were going to create the new form) and then nothing else happened. The Switchboard was still there, but there was no form.Comment
-
TO create an Instance of your Form:- Remove all references to the Collection.
- Declare frm as Public in a Standard Code Module.
- Download the Attachment for a visual.
Attached FilesComment
-
Well, I hate to be so dense, but it's still not working at all, just that flash. Here's what I have, and "OpenAClien t" is on my Switchboard:
What am I missing?Code:Option Explicit 'Purpose: Open an independent instance of form frmClient. Public frm As Form Function OpenAClient() 'Open a new instance, show it, and set a caption. Set frm = New Patient_IUR_Overview frm.Visible = True frm.Caption = frm.Hwnd & ", opened " & Now() End FunctionComment
-
- Is Public frm As Form declared in a Public Code Module?
- Do you wish to create a Single Instance of the Form or Multiple Instances?
- If you cannot get this issue resolved, can you Upload the DB to either this Forum or my personal E-Mail Account?
Comment
-
Where do I find out whether the module it's in is public? And I do want to create multiple instances of the form; single instance has been working great all along--the whole point of this particular question was for my users to be able to have more than one instance of this form open at a time.Comment
Comment