Connecting Tech Pros Worldwide Help | Site Map

Automatic timed deletion of tables

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 02:56 PM
Wilsoch
Guest
 
Posts: n/a
Default 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.


  #2  
Old November 13th, 2005, 02:56 PM
pietlinden@hotmail.com
Guest
 
Posts: n/a
Default Re: Automatic timed deletion of tables

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

  #3  
Old November 13th, 2005, 02:56 PM
pietlinden@hotmail.com
Guest
 
Posts: n/a
Default Re: Automatic timed deletion of tables

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

  #4  
Old November 13th, 2005, 02:56 PM
Wilsoch
Guest
 
Posts: n/a
Default Re: Automatic timed deletion of tables

Thanks for the info.

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

  #5  
Old November 13th, 2005, 02:56 PM
pietlinden@hotmail.com
Guest
 
Posts: n/a
Default Re: Automatic timed deletion of tables

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.)

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.