By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,312 Members | 1,723 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,312 IT Pros & Developers. It's quick & easy.

Automatic timed deletion of tables

P: n/a
Non-programmer here again because my developer stinks. I'm desperately
seeking a solution to this issue:

I need something in the open event on my main form that will cause all
of the tables to delete after a set period of time (7 days).

The database will be run locally on individual user's machines. Also, I
have a date format issue because some of the users will have MM/DD/YY,
others will have DD/MM/YY on their systems.

Is it possible to do something like this? If you could put me on the
right track, I can keep searching through the myriad Access books I've
had to purchase.

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
this one's a no-brainer.

Say you store the last date the delete was run in a custom property or
on a table... You can assign that value to a date variable and then run
all your deletes through code...

something like
dim tbl as string
for intCounter = 0 to CurrentDb.Tabledefs.Count-1
tbl=currentdb.tabledefs(intCounter).Name
If left$(tbl)<>"MSys" Then
CurrentDB.Execute "DELETE * FROM [" & tbl & "] WHERE
DateDiff("d",FieldInTable,Date)>7"), dbfailOnError
End If

note - this is all totally off the top of my head. And with a delete
query going on, test this first on a backup....

Nov 13 '05 #2

P: n/a
oh, yeah...that word "timed" ... you could do this in the startup of
the app.... just call your function that does the deleting...

Nov 13 '05 #3

P: n/a
Thanks for the info.

I thought the different date formats might cause an issue here. You
don't see that as an issue?

Nov 13 '05 #4

P: n/a
The date formats shouldn't matter as long as their stored in a
consistent manner. As long as you store according to US format or
force the dates into US format, then it's fine. (Allen Browne etc -
the folks from down under can probably answer this better than I - as I
live in the US, so usually don't have to deal with it.)

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.