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

linked forms

Status
Not open for further replies.

hcg

Technical User
May 17, 2000
5
NL
I encountered a problem when trying to link separate forms: I got two tables, one being the 'main' table with an autonumbered primary key. A second table has a many-to-many relationship with the main table, thus having two primary keys. One primary key is autonumbered, the other which connects both tables in the relationship is a long int.<br>The main form's record source is the main table, the second form's record source is the second table. A button was placed on the main form using the Wizard for opening the second form and 'find specific data to display' where the matching fields are both related primary keys. <br>The problem is that no record in the second table is generated with a corresponding primary key value of the current record on the main form. The field where the primary key of the second form is displayed stays empty after opening the second form. Can you help me out?<br>
 
1) Your second table cannot contain &quot;two primary keys&quot;. Only one primary key is possible per table, although that one primary key <i>may</i> be be a concatenated key, i.e., composed of more than one field. The primary key of any table, when placed in another table to link two tables, is referred to as the foriegn key. <br>2) You can't do much with a many-to-many relationship. It sounds like your relationship may be one to many, but if it <i>is</i> many to many, you need to build a&nbsp;&nbsp;third table to resolve it. Remove the foriegn key from the second table. Build a third table. Make it's primary key an autonumber, then add two more number fields (Long Integer) for your 2 forign keys, one for the main table link and the other for the second table link.<br><br>Now you should be able to build a form that works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top