Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting Databases

Status
Not open for further replies.

blarson0

Programmer
Jun 12, 2002
85
US
Is there a way in VBA to delete a database? I am writing a script to back up a database, make a .MDE file, and then I want to delete the temporary .MDB... I could write a batch file to do this, but I would prefer to keep all the code in one file.

Thanks!

-Brad
 
You can use the Kill statement. See ACCESS help for a full explaination but it looks like this:

Kill "c:\yourpath. . \databasefile.mdb"

or

Kill "\\SERVERname\path. . \databasefile.mdb"

Good luck

Bob Scriver
 
Gentlemen,

I wish mine would work like a charm. I have created a temporary database to do some work in for a form. When the form closes I receiving a Runtime Error 75: File/Path Access Error.

I've been over the code many times and cannot figure out what is causing the error. The filepath is fine, I think access is the problem. Like I have some object open that is stopping the command from being executed. In the OnClose I am performing the following:
1) Removing the temp db's tables from listbox RowSources
2) Closing the recordsets to the temp db
3) Closing the temp db
4) Refreshing current db's tabledefs
5) Setting temp db recordsets to nothing
6) Setting the temp db to nothing
7) deleting links to temp db in current db
and finally failing at Killing the temp db

This is driving me crazy. I have been following the logic of Tony Toews, Granite Consulting and his demo dB works flawlessly. I have been over it 20 times now. Does anyone have any thoughts to share?
Regards, Sorrells
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top