Hi Janis
This is taken from an answer I gave to a simaler probelm a while ago.
______________________________________________
DO NOT use a Kill code unless you know what you are doing or you will be
(really) sad. Once it’s gone (your database) it’s gone ??
______________________________________________
I have assumed that you want to keep/upgrade a DB on a drive called "C"
You are taking the upgrade from a drive called "E".
Change the drives to what they areally arte and all the other paths and
sections.
Simply create a form (on the machine you want the upgraded DB to be on) and
a button on it and use this OnClick.
Private Sub ButtonName_Click()
Dim strOldPathName As String
Dim strNewPathName As String
'Delete the old file'
Kill "C:\Documents and Settings\My Documents\DBName.mdb"
'Copy external database to local drive'
strOldPathName = "E:\DBName.mdb"
strNewPathName = "C:\Documents and Settings\My Documents\DBName.mdb"
DBEngine.CompactDatabase strOldPathName, strNewPathName
End Sub
E:\ is a DataStick but this works from/to any drive. Not too sure about
CD/RW or CD/R though.
I have used compact DB at the end as I feel it needs it (not for any other
reason) so this is up to you. Change the path names to what they are and you
up and running.
________________________________
It may be that you want to check that your DB really has transferred across
before you start using it so in this case you could import and use any name
then after you’re happy with it, simply rename the new DB (run the kill code
just before the rename or it will not work)
'Rename the copied DB to another name'
Dim OriginalName, As String
Dim NewName, As String
OriginalName Name = "C:\Documents and Settings\My Documents\DBName.mdb"
NewName = "C:\Documents and Settings\My Documents\SomeNewNameHere.mdb
"Name OriginalName As NewName
Note I have not included a check to see if the DB exists on the laptops as
it always does but you could include this if you feel it ness.
Hope this helps