Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to create multiple instances of form depending on selection made

Status
Not open for further replies.

infoscion

Technical User
Jan 21, 2005
50
0
0
US
Hi:
I am working on a database to enter customer data. In my previous thread I had asked for information about ways to transfer information from one form to another. I did manage to figure it out. I was wondering as to whether there is a way by which I can have multiple instances of the same form open up depending upon the selection made in terms of an unique identifier. inputs are solicited.
Info
 
Dim frm1 as form
dim frm2 as form

sub whatever()

Set frm1 = new FORM_myformname
Set frm2 = new FORM_myformname

frm1.visible = true
frm2.visible = true

end sub
 
Hi:
Thank you for responding to my inquiry. Let me qualify my request little better.

I have two forms, say form 1 and form 2. Form 1 houses customer records. As I select form 1 by clicking on a particular ID, I want form 2 to pop up with the ID transferred to form 2. Also as I select another entry from form 1 , I want form 2 to pop up with another ID transferred. I want both instances of form 2 to be visible such that I can move back and forth between them.


Please help me with some ideas/code if this is doable.
Regards,
Info
 
I don't understand the concept of 'transferring an ID'.

This is two copies of the same form. Therefore they are looking at the same data. Whatever exists in one exists in the other.
 
You can use code along these lines:

Private mfrmCustomer as Form_frmCustomer

Private Sub OpenNewCustomerForm()
Set mfrmCustomer = New Form_frmCustomer
With mfrmCustomer
.RecordSource = "SELECT * FROM MyCustomerTable WHERE (MyID = 1)"
.Controls("MyID").Value = Me("MyID").Value
.Visible = True
End With
End Sub

Once you have a reference to the form (in this case mfrmCustomer) you automatically have a reference to all the properties of the form. This includes any properties, functions or procedures that you have created on the form and made public (by using the Public keyword).

If you are opening a form that has data attached, remember to filter the data or set the MaxRecords to 1 other wise you can get performance issues.

I hope this helps
Justin
 
Hi:
Thank you for your inputs. I am actually looking at two copies of the same form but each of the two copies includes different data. So how do I accomplish that?
Regards,
Info
 
Are these forms unbound to any data source and are you placing data in unbound fields on both forms?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top