Delete a Database

MarionD

Registered User.
Local time
Today, 22:25
Joined
Oct 10, 2000
Messages
431
Hi there,
Hope someone can point me in the right direction!
Problem:
I want to delete a Database from within a different Database.
Reason:
I have a new Version of my Backend Db. In the Conversion Database I take the following steps:
1. I import the tables from the Backend “DataDB” (old Version)
2. Link the tables from a empty TempVersion of New Backend say “TempDataDB”
3. Do all the importing and Updating I need to do from old Tables to new Version Tables
4. With FileCopy I now create a copy of the Old Data say, “DataDB_Version5”
5. With Filecopy I overwrite the old Version, “DataDB” with the new Version (so the name remains the same)(FileCopy “TempDataDB”, “DataDB”)

6. NOW I NEED TO DELETE THE “TEMPDATADB”
AND I DON’T KNOW HOW!!

Hope this makes sense to someone!
Thanks
Marion
 
Hi MarionD,

How often are you deleting this file?

Robert88
 
Hi Guys,

thanks for the answers.
Rob, this is a once off - just to convert my back end DB to a new version. I am doing it this way, because there are so many changes in the BE - every table has been renamed, as well as every field. It is easier to import the old data into the new format, than trying to change the table names in the old!
Problem is I want the Backend DB to have the same name as before.

RuralGuy, thanks I think the kill will work, but the DB is open - I need to close it first - is there the reverse of opendatabase(..) e.g. closedatabase(...). I canonly find a closecurrentDatabase. I think the one I the code is running from is the currentDB??
 
Hi MarionD,

I do not understand why you want to do this through code if it is a one of, I would just go to the folder and hit delete, or am I missing something here?:rolleyes:

Robert88
 
Hi Robert,
The Prog. is distributed to over 200 towns all over Germany! I must have an automatic Update Feature. The idea is that they they start the DB Konversion and it does all the rest!

My problem now is to close the Temp DB!
thanks
 
What is the full line for opendatabase(..) It opens a DAO workspace object and it should have a .Close method.
 
Hi MarionD,

You have presented a good problem.

Just thinking out a loud,

I have been looking at msaccess.exe /cmd

/cmd Specifies that what follows on the command line is the value that will be returned by the Command function. This option must be the last option on the command line. You can use a semicolon (;) as an alternative to /cmd.
Use this option to specify a command-line argument that can be used in Visual Basic (Microsoft Visual Basic: A high-level, visual-programming version of Basic. Visual Basic was developed by Microsoft for building Windows-based applications.) code.

But not sure if this will help you?:confused:

Robert88
 
Hi MarionD,

You have presented a good problem.

Just thinking out a loud,

I have been looking at msaccess.exe /cmd

From Microsoft;

/cmd Specifies that what follows on the command line is the value that will be returned by the Command function. This option must be the last option on the command line. You can use a semicolon (;) as an alternative to /cmd.
Use this option to specify a command-line argument that can be used in Visual Basic (Microsoft Visual Basic: A high-level, visual-programming version of Basic. Visual Basic was developed by Microsoft for building Windows-based applications.) code.
But not sure if this will help you?:confused:

Robert88
 
Hi MarionD,

You have presented a good problem.

Just thinking out a loud,

I have been looking at msaccess.exe /cmd

From Microsoft;

/cmd Specifies that what follows on the command line is the value that will be returned by the Command function. This option must be the last option on the command line. You can use a semicolon ';' as an alternative to /cmd.
Use this option to specify a command-line argument that can be used in Visual Basic (Microsoft Visual Basic: A high-level, visual-programming version of Basic. Visual Basic was developed by Microsoft for building Windows-based applications.) code.
But not sure if this will help you?:confused:

Robert88
 
Hi Marion,

Damn it about all the editions I did, how do I delete them????

I have also done some research on the kill function.

it states that in the example I have here, that if an object uses a Get Method it places a read only attribute on the file.

in order to use the kill read only is required to be removed.

Code:
SetAttr strTempFile, vbNormal 'to remove read only attribute
Kill strTempFile

I hope this helps?

Robert88
 
Last edited:
Thanks again for the answers.

In the Exporer the .ldb of my DB was still open. This is why the DB could not be copied, deleted, renamed... Since then I have found out that the .LDB is open if you don't close ALL the recordsets that have been used. So first of all CLOSE all recordsets nice and clean!! Then one can set the Variable back to nothing. eg if I said set DataVersion5=db.openDatabase(Path,...) then I can set DataVersion5=nothing.

My problem is solved by doing this.
Thanks for the time taken!!

Marion
 

Users who are viewing this thread

Back
Top Bottom