I have table Orders with an ID autonumber field
I have table Detail with a field 'OrderID' which points to ID field in table Orders.
One or Many records in table Detail point to a single Order record.
The ID's in table orders have to be changed/resequenced which in turn means that the 'OrderID' fields in table Detail must now point to the new 'OrderID'.
I have created a new table Order_Reseq and appended all of the order records to it. The append query appends the ID field in the original Order table to a field called OldID in the table Order_Reseq. The fields in Order_Reseq are:
ID which is an autonumber
OldID which is the ID from the original Orders table
Now I must change all of the 'OrderID' fields in table Detail to point to the new ID in 'Orders_Reseq'.
One idea I have is to loop thru table Orders_Reseq record by record. For each record I would execute and update/set query on table Detail revising 'OrderID' to the value of 'ID' in table Orders_Reseq' for every record
Read thru Order_Reseq record by record
updateString = " Update tblDetail " & _
" Set [OrderID] = " & rsIn!ID & _
" Where [OrderID] = " & rsIn!OldID
I am thinking there must be a better way, so that is the question. Is there an easier more efficient way of revising all of the 'OrderID' fields in to the revised ID in the orders table?
Efficienty is important because their are approximatley 3 million records in the order table and 8 millionn in the Detail table.