Good morning
There is a way in order to auto delete a database after eg. 7 days
Thanks in advanced
Good morning
There is a way in order to auto delete a database after eg. 7 days
Thanks in advanced
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
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
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
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..
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...
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
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...
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.
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
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
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.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
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.