Automatically remove table from append query

L

LH

After runing an append query I want the (from) table to be removed to help
prevent creating duplicate records the next time the query is run.
 
M

MGFoster

LH said:
After runing an append query I want the (from) table to be removed to help
prevent creating duplicate records the next time the query is run.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The SQL command for dropping a table is (Run from the SQL View of a
query - it cannot be part of the append query):

DROP TABLE TheTableName

You can also use VBA:

DoCmd.DeleteObject acTable "TheTableName"

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSWzh7IechKqOuFEgEQJaHQCePpKd5FJHnkW2NznDp1++BQsrWDUAmwbm
VM46dj3O1K7UaC7Is4JZbK4c
=epC6
-----END PGP SIGNATURE-----
 
J

John W. Vinson

After runing an append query I want the (from) table to be removed to help
prevent creating duplicate records the next time the query is run.

Do you want to *remove the table itself* - all the data *and* the structure?
Or do you just want to empty the table, deleting all the records which were
added?

I'd prefer the latter, which can be done easily using a delete query

DELETE * FROM sourcetable;

or, better, to prevent deleting records which didn't append

DELETE sourcetable.*
FROM sourcetable
INNER JOIN targettable
ON sourcetable.primarykeyfield = targettable.primarykeyfield;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top