Multiple instances of Screens/Forms

F

Fernando

Hi there,

I have 2 forms: FormA and FormB. One opens FormB by clicking on a button on
FormA.

FormB contains information on record in the database. I would like to be
able to open multiple FormB at one time - i.e. multiple instances of FormB.

I am using the DoCmd.OpenForm method. What happen now is that only one
screen/FormB is opened, and every time I click the button in FormA (for a new
record) the new data appears in the single FormA that was already opened.

What should I use to the get multiple instances of FormB ?

Thank you very much.
Cheers
 
A

Allen Browne

Use the New keyword, e.g.:
Dim frm As Form
Set frm = New Form_FormB
frm.Visible = True

That's the easy part, but the form only remains open for the lifetime of the
frm variable. To manage its lifetime, add it to a custom collection. There's
a downloadable example in this article:
Managing Multiple Instances of a Form
at:
http://allenbrowne.com/ser-35.html
 
F

Fernando

Cheers Allen.
--
Fernando


Allen Browne said:
Use the New keyword, e.g.:
Dim frm As Form
Set frm = New Form_FormB
frm.Visible = True

That's the easy part, but the form only remains open for the lifetime of the
frm variable. To manage its lifetime, add it to a custom collection. There's
a downloadable example in this article:
Managing Multiple Instances of a Form
at:
http://allenbrowne.com/ser-35.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top