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

Linking forms

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How do I link several forms with a common project id?
 
If all the forms share the same record source i.e if the same Table name appears in each form's ControlSource then they are already linked by that table and more particularly by the table's Primary Key field.

If the the forms get their records from different tables then one table must be the main data source and the other tables must have a foreign key field that matches the primary table's Primary key field.

Look up "foreign keys" in the Access Help browser.
--------------------------------------------------------

If you want to syncronise several forms that are all based on the same data table then here's one way to do it...

Create say three forms and lets call them Form_A, Form_B and Form_C.

In the OnCurrent event of Form_A write the following code:

If IsLoaded("Form_B") Then
DoCmd.SelectObject acForm, "Form_B", 0
DoCmd.GoToRecord , , acGoTo, Forms!Form_A.CurrentRecord
End If

If IsLoaded("Form_C") Then
DoCmd.SelectObject acForm, "Form_C", 0
DoCmd.GoToRecord , , acGoTo, Forms!Form_A.CurrentRecord
End If

Now if either Form_B and/or Form_C are open they will track Form_A record for record.

If either Form_B or Form_C are not open an error will occur unless the IsLoaded function call is made.

You can copy the IsLoaded function from the Northwind Traders database Utility module.

Copy the function to a Public module in your database.

regards
Rod
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top