Open up multiple copies of a form

I have a form called Contact, but I want to open several copies of each form from clicking on commands from other forms (so could have 6 open forms up, all referencing different records.

I managed to open one form, but when I was on another form the first open instance was closed and the new one opened up, I want to keep the old one open and open a new. I managed to open one by:-
DoCmd.OpenForm "Contact", acNormal, , "ContactId = '" & ContactId & "'", acFormEdit, acWindowNormal

Open in new window


After reading about I managed to find an example code of:-
    Set frmMulti = New Form_Contact
    frmMulti.SetFocus

Open in new window


But it doesnt work at all, and cant see anyway of filtering the record.

Any ideas?
tonelm54Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<I have a form called Contact, but I want to open several copies of each form from clicking on commands from other forms (so could have 6
open forms up, all referencing different records.>>

 While you can open multiple instances of the same form because forms are based on classes, it's a bit of a pain in the neck to do so.  Why?  Because all have the same name.

 That means you need to keep track of them somehow, which is usually with an object reference stored in a collection.   Then you change the caption to something like "Contacts - 1", "Contacts - 2", etc so visually you can tell them apart.

 To work with them, you always need to look at the collection, and/or hold an object variable so you can point to the right form instance.

The other approach is to copy the form as many times as you need it and literally call it frmContact1, frmContact2, etc.   Doing this, you don't need to keep track of the forms in a collection as you can refer to them by name.

 What also helps is that you can use syntax like this:

 For intK = 1 to 6:  Debug.Print Forms("frmContact" & intK).Name: Next intK

 and refer to them using a variable.

Most use the second approach.  If you want to tackle the first, let me know.

Jim.
Dale FyeOwner, Developing Solutions LLCCommented:
Allen Browne has a great discussion of this topic, and associated code on his web site

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.