Results 1 to 12 of 12
  1. #1
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167

    auto delete database

    Good morning



    There is a way in order to auto delete a database after eg. 7 days

    Thanks in advanced

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You could create a batch file that will delete it, and use Windows Scheduler to schedule it to run on a specific day.
    http://stackoverflow.com/questions/1...o-delete-files

  3. #3
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167
    JoeM thank you very much for the help,

    Its not this i'm looking for my friend..

    I just need a solution in order to calculate the days (eg 7) and then does'n matter where will be the file, to delete it..

    Any idea?

    Thank you again

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Why exactly would you want to do this?

    There is a discussion here on creating a "self-destructing database", but as you can see, most programmers are very suspicious of the need to create something like this.
    http://bytes.com/topic/access/answer...-destruct-code

  5. #5
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167
    Good morning JoeM,

    I need to use this for a temporary database which already are in used by 7 users for just 2 weeks in order to finish some "doggy work" regarding the inputs of around 10,000 records of some informations.

    Actually the manager asked for me to do that..

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    If you have multiple users using the database, you should, first of all, use split your database into a front-end and back-end, if you have not done so already. So each user should have their own copy of the front-end database which should be copied/run from their desktop.

    Now, here is what I would recommend giving this users to run the database. Instead of a shortcut on their desktop to the Access database, make a shortcut to a batch file that you place out on the network. What this shortcut does is the following:
    - copies the most recent front-end of the database from the network to their C: drive
    - opens the Access database

    Then, when you don't want the users to run the database anymore, you can simply edit the batch file on the network so that instead of copying and opening the front-end, it deletes the front-end and tells them that the database is no longer available for them.

    Another thing you can do is to add some VBA code to that particular front-end that you are giving to these users that will automatically close the database when they try to open it if it is after a particular date. I would do this by setting a Start-Up Form in your Database, and attaching the VBA code to the Load property of that Form.

    So there's a few ideas for you to consider...

  7. #7
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167
    JoeM Hi,

    The 7 users are not in the same network my friend... Its just 7 copies of the database.. That's why we are looking to find this solution..
    Note: The 7 users are external co-operators of the company and its critical to find a solution in order to delete the database after the complition of their work.

    Thanks again

  8. #8
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    why not just delete the content? tables forms etc.
    have a destroy table containing a date.

    the db must be opening a form. in that form have it set up check destrory_date - date()>=7, if so
    DoCmd.DeleteObject acTable, "sampler"

    delete all the tables forms etc...

  9. #9
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    So qadx12 suggestion is an extension of my last proposal, and is probably your best bet. Just like you can have code called from Start-Up Form to close the database, you could have the code do other things like delete the database objects.

    However, the database needs to be opened for this to happen. If they never open it after that date, those objects will still exist.
    And there are ways to open an Access database to bypass Start-Up Forms. If they do that, the code will not run.
    Or, they could link to the Access tables from other Access databases, Excel files, etc and view all your data.

    So none of these solutions are really foolproof. Access is not known for strong security. And you are very limited by the fact that these files will be used on other networks that you have no control over.

    I still do not understand, though, the need to delete the database. You are obviously giving them access to the data in the first place. If it is some sort of Security measure, it is a poor plan, as they could easily export/copy that data off somewhere else on their system any time they are working on. So don't be lulled into thinking that deleting the database will fulfill some sort of Security requirement, because by nature of it, it is not very secure at all.

  10. #10
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167
    Good morning all
    I thing your idea gadx12 its an a good idea to start with. I will try to delete the objects..

    Do you have any ideas about on how can select all objects at once?

    Thanks again guys

  11. #11
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    this is a link to the ms support page which discusses how to delete all tables quickly.

    http://support2.microsoft.com/kb/210307

    i liked this code from a page
    Code:
    Sub Delete_tbl
        Dim t as TableDef
        For Each t In CurrentDB.TableDefs
            If t.Name Like "tbl*" Then DoCmd.runSQL("DROP TABLE " & t.Name)
        Next
    End Sub
    like JoeM said, there are ways to work around this. i suspect you dont need to protect the data, just design... just dont use this maliciously.

  12. #12
    gstylianou is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Dec 2013
    Posts
    167
    Hello everyone,

    qa12dx thank you very much for your help. I'll try to add the code in a test database in order to check it first and if i will have any other issue i'll be back again.

    Thanks again.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 03-19-2014, 04:51 PM
  2. Auto Delete Record on Date in Field
    By SmartestIdiot in forum Access
    Replies: 7
    Last Post: 01-04-2014, 08:54 AM
  3. Auto Delete record after 3 years?
    By maxx102 in forum Access
    Replies: 3
    Last Post: 06-01-2012, 08:55 PM
  4. auto delete duplicates
    By sammiantha in forum Access
    Replies: 2
    Last Post: 04-17-2012, 02:37 AM
  5. Replies: 7
    Last Post: 03-15-2011, 11:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums