G
Guest
I have a 3 tables,
table 1 table 2 table 3
ID ID J_ID
Part Number Part Number NHA_ID
J_ID NHA
on a form, i have table 3 a subform in table 2, and table 2 a subform in
table 1. There is a form that pops up when the user wants to duplicate the
record, and the user can change some data on that form. I got it to
duplicate the data in table 1 and table 2, but am stuck on duplicating the
data in table 3 correctly.
this is the sql data for appending data to table2
If Me.table2_subform.Form.RecordsetClone.RecordCount > 0 Then
strSQL = "INSERT INTO table2(ID, part_number, " & _
"SELECT " & lngMPNID & " As ID, " & _
"table2.part_number " & _
"FROM table2 " & _
"WHERE (table2.ID = " & Me.ID & ");"
db.Execute strSQL1, dbFailOnError
End If
this is the sql statement for table 3
If me.table2_subform.Form.table3_subform.Form.RecordsetClone.RecordCount > 0
Then
strSQL = "INSERT INTO table3 (J_ID, NHA) " & _
"SELECT " & LngJID & "AS J_ID, table3.NHA" & _
"FROM (table1 INNER JOIN table2 ON "(table1.PART_NUMBER
= table2.PART_NUMBER) AND (table1.ID = table2.ID)) " & _
"INNER JOIN table3 ON table2.J_ID = table3.J_ID " & _
"WHERE (table2.ID = ME.ID " & ");"
db.Execute strSQL, dbFailOnError
End If
Any help on fixing this sql statement would be appreciated. Thanks.
ash
table 1 table 2 table 3
ID ID J_ID
Part Number Part Number NHA_ID
J_ID NHA
on a form, i have table 3 a subform in table 2, and table 2 a subform in
table 1. There is a form that pops up when the user wants to duplicate the
record, and the user can change some data on that form. I got it to
duplicate the data in table 1 and table 2, but am stuck on duplicating the
data in table 3 correctly.
this is the sql data for appending data to table2
If Me.table2_subform.Form.RecordsetClone.RecordCount > 0 Then
strSQL = "INSERT INTO table2(ID, part_number, " & _
"SELECT " & lngMPNID & " As ID, " & _
"table2.part_number " & _
"FROM table2 " & _
"WHERE (table2.ID = " & Me.ID & ");"
db.Execute strSQL1, dbFailOnError
End If
this is the sql statement for table 3
If me.table2_subform.Form.table3_subform.Form.RecordsetClone.RecordCount > 0
Then
strSQL = "INSERT INTO table3 (J_ID, NHA) " & _
"SELECT " & LngJID & "AS J_ID, table3.NHA" & _
"FROM (table1 INNER JOIN table2 ON "(table1.PART_NUMBER
= table2.PART_NUMBER) AND (table1.ID = table2.ID)) " & _
"INNER JOIN table3 ON table2.J_ID = table3.J_ID " & _
"WHERE (table2.ID = ME.ID " & ");"
db.Execute strSQL, dbFailOnError
End If
Any help on fixing this sql statement would be appreciated. Thanks.
ash