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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transfering data from one table to another

Status
Not open for further replies.

valgore

Technical User
Nov 12, 2008
180
US
i have a database that is for Amex charges. i import charges in a table and when all of the charges are categorized, i want to click a button and have it move to a archive table. ive looked at all the functions and i cant seem to find a way to make it work.

any ideas?

Valgore
 
What type of database? Access, SQL Server, MySQL, etc....

Usually, something like this needs to be done in two steps.

1. Insert data in to archive table.
2. Delete data from original table.

Ex:

[tt][blue]
Insert Into ArchiveTable(Column1, Column2)
Select Column1, Column2
From OriginalTable

Delete From OriginalTable
[/blue][/tt]

Notice that there is no where clause (which is dangerous). If your database supports transactions, I strongly encourage you to use them.


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
What have you tried?

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
sorry. im using Access 2007. all i want to do is press a button and have all the data in one table to move to an archive table. i will be doing this every month. so another question i have is will the data stack on top on each other month after month?
 
What have you tried?

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
well, nothing so far. i was stumped when i couldn't find a transfertable function like the transferspreadsheet function. i tried to input your code into my button
Code:
Insert Into "AmexHistorical" (Column1, Column2, Column3)
Select Column1, Column2, Column3 From AmexCurrent

i get Compile Error: expected: end of statement on the "AmexHistorical"
and then i get Compile Error: expected: Case on Select Column1

Valgore
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top