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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two connected forms

Status
Not open for further replies.

slawc

Programmer
Jul 8, 2007
2
SI
Hi!

Can anyone give me an example how to relate two forms in ADP with data that are in two different tables and not in SQL database. Two tables have one key (some kind of ID). Example of use: in form1, user enters some information and after user clik the button on form1, form2 opens and data from one field in the form1 is transfered to form2.
Thanks!
 
I must correct myself. Table is SQL database.
 
you can use the OpenArgs criteria to pass values to a form when you open it, or you could directly reference another from if that form is open by using the Forms("FormName").ControlName syntax

--------------------
Procrastinate Now!
 
If you have similar names for the corresponding controls on the two forms (a naming convention), it's easy.

Example: Form1 has txtName, txtAddress, txtPhone
Form2 has the same controls

You have Form1 filled in and open Form2 from Form1.

In Form2 Load event:

Private Sub Form_Load()
Dim ctr As Control
On Error Resume Next
For Each ctr In Me.Controls
ctr=Screen.ActiveForm(ctr.Name)
Next
End Sub

This will copy the values from Form1 to the corresponding controls on Form2.


HTH

[pipe]
Daniel Vlas
Systems Consultant

 
You can also run code in the oncurrent event of the parent form that sets the recordsource parameter of the child form.

[COLOR=#aa88aa black]Cum catapultae proscriptae erunt tum soli proscript catapultas habebunt.[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top