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

Auto copy records from table1 to table2 -> delete those records

Status
Not open for further replies.

Krash878

Programmer
May 8, 2001
172
US
I have a table called tblRecords and another table called tblRecordsArchive. To keep the speed of the database up I manually copy any record that is more than 90 days old to tblRecordsArchive. I usually do this on the first of every month.

I would like to make a macro or module that would perform this task on the 1-5 of every month without my assistance.

What would I need to do to make this happen?

Krash
 
Use an Append query with appropriate criteria to add the records from tblRecords to tblRecordsArchive, then run a Delete query with the same criteria to delete those records from tblRecords. You could run these from a command button using the DoCmd.OpenQuery command. If you want the process to be completely transparent to the users, you would need to use the SetWarning command to turn the warning messages Off before the queries were run, and back on again after the queries have finished. You may also find it useful to have an "UnArchive" routine as well to reverse any records that should not have been archived.

HTH
Lightning
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top