Hi everyone,
Firstly I am using access 2007. I currently have 2 tables in my database, 1 to store up to date data and the other to store out of date data (where data edits have been made, for audit purposes). I have set up a one-to-many relation ship between the 2 tables based on the record number.
I use a form to search for records which opens up a split form to show all of the matching records. I do have a code which selects and copies the old data before it is replaced, it is then replaced and the code then pastes the old record into the second table. (the macro is posted below N.B. it was written in access 2007's macro builder window).
My problem is that the record that is copied and pasted is always the first record in the database not necessarily the record being edited. Can anyone help (I feel that the solution is quite simple and I have tried various different solutions but I can't quite get the right solution (the macro posted is my best attempt so far).
Firstly I am using access 2007. I currently have 2 tables in my database, 1 to store up to date data and the other to store out of date data (where data edits have been made, for audit purposes). I have set up a one-to-many relation ship between the 2 tables based on the record number.
I use a form to search for records which opens up a split form to show all of the matching records. I do have a code which selects and copies the old data before it is replaced, it is then replaced and the code then pastes the old record into the second table. (the macro is posted below N.B. it was written in access 2007's macro builder window).
My problem is that the record that is copied and pasted is always the first record in the database not necessarily the record being edited. Can anyone help (I feel that the solution is quite simple and I have tried various different solutions but I can't quite get the right solution (the macro posted is my best attempt so far).
Code:
On Error Next, OpenTable CD Signatures, Datasheet, Edit RunCommand SelectRecord RunCommand Copy RunCommand Replace RunCommand Refresh OpenTable Edited Signatures, Datasheet, Edit GoToRecord Table, Edited Signatures, New RunCommand SelectRecord RunCommand Paste Close Table, CD Signatures, Yes Close Table, Edited Signatures, Yes RunCommand Refresh
Comment