Ok I have two tables both with an ID field, whenever a record is deleted these need to be renumbered to keep corresponding data. Here is the code I am using to do this:
Whenever it runs it gives me an error saying no current record. I tried commenting out stuff to see where it was hanging up at and it is fine until rs3!ID=i. Does this mean this table needs focus to be able to do this or what?
Code:
Dim db As DAO.Database Dim rs2 As DAO.Recordset Dim rs3 As DAO.Recordset Set db = CurrentDb() Set rs2 = db.OpenRecordset("PrinterCartInventory") Set rs3 = db.OpenRecordset("CartUse") rs2.MoveFirst i = 1 Do Until (rs2.EOF And rs3.EOF) rs2.Edit rs2!ID = i rs2.Update rs3.Edit rs3!ID = i rs3.Update i = i + 1 rs2.MoveNext rs3.MoveNext Loop
Comment