Move the Current line of data in a form to another table

LDARBY

New member
Local time
Today, 15:09
Joined
May 4, 2009
Messages
1
I am new to Access but have 25+ years with Oracle.

I have two tables and a form on the first table.

I want to create a button on the form that when pushed will copy most of the columns of that record into another table, then delet the record from the current table if the move was successful.

How can I do this in Access 2007?
 
I am new to Access but have 25+ years with Oracle.

I have two tables and a form on the first table.

I want to create a button on the form that when pushed will copy most of the columns of that record into another table, then delet the record from the current table if the move was successful.

How can I do this in Access 2007?

I assume that you have a unique fld (like an xxxxID Indexed No Duplicates).

You will need some DAO code.
1. Create a RecordsetClone from the form. (rst1)
2. Use FindFirst to locate the record (on the xxxxID fld).
3. Call up the 2nd tbl (rst2), use rst2.AddNew etc then rst2.Update
4. use rst1.Delete to delete the original record.

To test code, set a breakpoint after all the "Set" cmds and press F8 to step thru the code line by line.
 

Users who are viewing this thread

Back
Top Bottom