Help with updating tables in many-to-many relationship

D

Dick

Hi,

I am working on a database that contains a many-to many relationship.
I created an intermediate (linked) table between the two primary
tables. I have a Form1 that displays the info from Table1 and a
control to open a Form2 that displays records from Table2 that match
the Table1 record. Everything works great for displaying and editing
information on Form2 except for when I try to add records. I don't
seem to have the right code to update the Linked Table. Does anyone
have some sample code that works?

My tables include the following:

Table1
Table2 Linked Table
Prog_ID
BA_ID Link_ID
Prog_Name BA_Name
BA_ID

Prog_ID

Thanks in advance,
Dick
 
D

Dick

Hi,

I am working on a database that contains a many-to many relationship.
I created an intermediate (linked) table between the two primary
tables. I have a Form1 that displays the info from Table1 and a
control to open a Form2 that displays records from Table2 that match
the Table1 record. Everything works great for displaying and editing
information on Form2 except for when I try to add records. I don't
seem to have the right code to update the Linked Table. Does anyone
have some sample code that works?
Let me clarify the tables.

Table 1
Prog_ID
Prog_Name

Table 2
BA_ID
BA_Name

Linked Table
Link_ID
Prog_ID
BA_ID
 
J

John W. Vinson

I am working on a database that contains a many-to many relationship.
I created an intermediate (linked) table between the two primary
tables. I have a Form1 that displays the info from Table1 and a
control to open a Form2 that displays records from Table2 that match
the Table1 record. Everything works great for displaying and editing
information on Form2 except for when I try to add records. I don't
seem to have the right code to update the Linked Table. Does anyone
have some sample code that works?

Use a Form based on one of the "one" side tables, and a Subform based on the
"Linked Table".

See the Orders form in the Northwind sample database for an example. The two
"one" tables are Orders and Products, and the "Linked Table" is OrderDetails.

John W. Vinson [MVP]
 

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