Originally Posted by
Deepak.Doddagoudar;391367
[ATTACH=CONFIG
Another problem with this: how do you know which [Machine System ID] belongs to each new Machine Subsystem? And which MachineSubSystem belongs to each new Component?
Anyway the nested loop I was referring to in post 18 would work something like this:
Code:
For i1 = 0 to something '<Looping through your list of records to add>
rs.AddNew
rs!Field1 = ...
rs!ForegnKeyField = ... '<your new machine id would go in the first foreign key field>
rs.update
rs.Bookmark = rs.LastModified 'When inserting a new record into a recordset, the new record does not automatically become the current record. To access the new record, move to the bookmark LastModified
For i2 = 0 to something
rs1.AddNew
rs1!Field1 = ...
rs1!PARENTKEY = rs![ID FIELD] '<the ID just generated when you ran rs.update above>
rs1.Update
rs1.Bookmark = rs1.LastModified
For i3 = 0 to something
rs2.AddNew
rs2.Field1 = ...
rs2!PARENTKEY = rs1![ID FIELD]
rs2.Update
'rs2.Bookmark = rs2.LastModified
Next i3
Next i2
Next i1
Make sense?