Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving Records from Table to Table

Status
Not open for further replies.

Tommy408

Programmer
Apr 30, 2006
53
US
My Code:
strSQL = "INSERT INTO OldAccounts SELECT * FROM ActiveAccounts WHERE ID = " & MyID & " "
DoCmd.RunSQL strSQL
strSQL = "DELETE FROM ActiveAccounts WHERE ID = " & MyID & " "
DoCmd.RunSQL strSQL

Where MyID is auto number from ActiveAccounts. When I run this line, if the in the OldAccounts is the same as MyID ( the ID that is being inserted ) it doesn't insert into OldAccounts . This code only insert record with ID from ActiveAccounts that OldAccounts doesn't have. How can I successfully move a record from ActiveAccounts to OldAccounts despite having same ID? Basically I want to Append a record from ActiveAccounts into OldAccounts.
 

The ID field in OldAccounts should not be an autonumber. Just a Numeric type, Long
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top