469,950 Members | 1,391 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

Automatic timed deletion of tables

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
4 1298
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
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
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
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
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.

Similar topics

2 posts views Thread by Sirano | last post: by
4 posts views Thread by Chris Stegeman | last post: by
1 post views Thread by Jim | last post: by
2 posts views Thread by Rune Froysa | last post: by
1 post views Thread by Michel Esber | last post: by
3 posts views Thread by myjish18 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.