View Full Version : How to delete records automatically


rajput
04-23-2001, 10:54 AM
Hello,

How can I keep only 8 months old data and delete all old data automatically or thru a command button if it is not possible and compact it after it is done. And it should give a waring box saying that are your sure you want to delete records from and to dates.

Thanks
Rajput

[This message has been edited by rajput (edited 04-23-2001).]

[This message has been edited by rajput (edited 04-23-2001).]

DES
04-23-2001, 04:28 PM
Well as for the deleting part that is easy. Make a delete query with the parameter on the date being greater than a datediff statement to calculate the number of months.

It could then be fired off a command button.

I can send you a sample of that if needed.

Compacting automatically is a little more difficult but it could be done. The tough part is that the database needs to be closed in order to do the compact. It would take a bit of thinking but I have a sample of doing it off a splash screen after a specified amount of time.

I could send it along as well though it will take a bit more time to get it set for how you would want it to work. Its up to you

DES

rajput
04-24-2001, 08:17 AM
Hi Des,

I think compacting is not nessessary it can be done anytime after the records have been deleted. If you can just help me with the delete query it will be great.

Thanks again for your help

Rajput

DES
04-24-2001, 09:07 AM
Just sent you the sample hope it helps. By the way copy the data before you run it so that if you need to run it again you have some data.

HTH

DES