Link to home
Start Free TrialLog in
Avatar of On_The_Level
On_The_Level

asked on

Save database used by VB via VB to other location???????

I am using VB6 and want to save a database (access 2000 database) via VB6 which i am using in my program.  The database is open and is used to store info in and i want the user to be able to save the database in a place of there choice but not over writting the one used by the program  by going to file and save as.  There for it really has to copy the database used by the program which is stored in the same folder as the program (app.path) etc.  and save it to another folder of the users choice.
I have got this bit to open the save as box but cant get anyfurther as to get it to atualy save the database.

Private Sub saveas_Click()
Dim sFile As String
 
    With CommonDialog1
        .DialogTitle = "Save As"
        .CancelError = False
        .Filter = "All Files (*.*)|*.*"
        .ShowSave
        If Len(.FileName) = 0 Then
            Exit Sub
        End If
        sFile = .FileName
    End With

Can anyone help cheers.

GM
Avatar of leonstryker
leonstryker
Flag of United States of America image

You need to copy the .mdb file instead.  Get the location with the Common Dialog control but then use the shell copy command to actually do this.

Leon
Avatar of On_The_Level
On_The_Level

ASKER

ok, how is this done then?
ASKER CERTIFIED SOLUTION
Avatar of AjithJose
AjithJose

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just one question how would you load the database back up would you use the same method???

Cheers folks

You can use this method to copy any file to anywhere.

But if the target files exists, it will be overwritten. Which is not possible if the database file is open. You have to close the currently open database to load the backed up database