Delete Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I have a query for deleting old orders from a table.
my criteria: < Date() -365

But I can't just delete the data.. how can I send this
data to a new database or table or maybe an excel file
(suggestions?) to keep an "Archive"

thx
 
Hi, I have a query for deleting old orders from a table.
my criteria: < Date() -365

But I can't just delete the data.. how can I send this
data to a new database or table or maybe an excel file
(suggestions?) to keep an "Archive"

Unless your table is extremely large (a term which, in this context,
means many millions of records), you may want to consider simply
adding a Yes/No field to the table, Archived; it should default to No
for new records, and your query (using a criterion of

< DateAdd("yyyy", -1, Date())

to handle leapyears correctly) should simply set it to True.

Any queries that need to retrieve only the past years' orders should
just use a criterion of False on the Archived field.

If you do really need to physically remove the records (again, it
shouldn't be necessary in a properly indexed table), you'll need to
run an Append query to append them to an archive table; this could be
in a separate backend database. Following the archive append you can
then run a Delete query.
 
Back
Top