im lost!

djshongo

Registered User.
Local time
Today, 20:43
Joined
Oct 25, 2005
Messages
34
hiya, im trying to create a button my form that will move all 'finished' records from where they presently are, to another table.
the button does work, it moves the records into the 'new' table, however it does not DELETE them from the table i moved them from, so now the records are stored in two tables??

the code i have is as follows:
SELECT * INTO Table2
FROM Table1
WHERE Finished='Yes';

if there is something different that i should be doing, or a better way to do this move, please let me know.

(also if this is in the wrong section feel free to move it)

thanks!
 
Yeah, you need to delete those same records after they have been copied. Your SQL only copies the records, it doesn't "move" them. Either write an SQL delete query or use and Access delete query, basically with the same criteria. You might want to insert some checks to ensure that all the records you are deleting indeed have been copied.
 
thanks for the reply!

do you have any tips for me or could you give me some guidelines....as im an amateur at SQL!

thanks again
 
Erm, if you are an amateur with SQL, why not use a standard access query? An Append query will allow you to add records to a table. A Delete query will allow you to delete records. You can then run each of these queries from a button.

If you really want to use SQL, I found this site a great place to start;

http://www.w3schools.com/sql/default.asp
 
thanks for the link, ive used that site a few times now.

and i know what you're saying about the two buttons, but ideally id like to control this function with ONE button...

any ideas??
 
I never said anything about two buttons. I said you can run BOTH queries you need to from A button. A button press simply carries out the code you specify; it can carry out any number of functions.
 

Users who are viewing this thread

Back
Top Bottom