backup database

Spira

Registered User.
Local time
Today, 13:59
Joined
Feb 23, 2004
Messages
35
thanks for your help on my previos post. the new problem i have is that i would like to know how to backup the database ,on click of a button or at the end of the week.
is there a way to chose a directory to where you wish to copy the database file to, like an installation program??, thanks
 
if you're not in an enterprise situation where your data is stored on a server, rather it is stored locally, you could always make a batch file that copies the database to a specified location and then use the task scheduler in windows to run the batch file at specified intervals.
 
Kodo said:
if you're not in an enterprise situation where your data is stored on a server, rather it is stored locally, you could always make a batch file that copies the database to a specified location and then use the task scheduler in windows to run the batch file at specified intervals.

how?
but i would like to copy the database preferabily on the click of a button
 
make a text file and rename it to DBBACKUP.BAT

edit it and paste this in: modify the paths and db name of course


copy c:\pathtodatabase\dbname.mdb c:\newpathlocation /y

ex:

copy C:\mydatabases\mydatabase.mdb C:\mybackups /y

the /y will allow you to overwrite old ones in the same directory.

You can place the batch file anywhere on your system and then make a shortcut to it on your desktop. It's a double click, but I'm sure you handle the extra calorie ;)
 
the sytem im making will be installed on a different computer than the one ive got at home and the directory that it may be installed is variable-
Is there a way of overcoming this problem like having \Mydatabse.mdb in the code rather than c:\path\mydatabase.mdb?
thanks
 
Spira said:
Is there a way of overcoming this problem like having \Mydatabse.mdb in the code rather than c:\path\mydatabase.mdb?
thanks

You can go that route. Easiest if you plan on storing the batch file in the same directory that the database file will be. However, it is possible to have a batch file perform a search to find the database. I recommend putting the batch file in the same directory. If that's the case..

copy mydatabase.mdb C:\mybackups /y

Any questions?
 
Spira said:
I would like to know how to backup the database ,on click of a button or at the end of the week.
Check out the link below for the code I posted to copy a database [while it is opened], zip it up, and move that copy to another location.
http://www.access-programmers.co.uk/forums/showthread.php?t=57863
You could easily add a browse function to my code to allow the user to [browse] select where they want to save the zipped backup file to.
http://www.access-programmers.co.uk/forums/showthread.php?t=64050

HTH
 
thanks for your help, the problem is resolved !!! :D
 
o1110010 said:
You can go that route. Easiest if you plan on storing the batch file in the same directory that the database file will be. However, it is possible to have a batch file perform a search to find the database. I recommend putting the batch file in the same directory. If that's the case..

copy mydatabase.mdb C:\mybackups /y

Any questions?

jus askin a quick question. if the user does not have the directory c:\mybackups then the backup comes as a .file. is there any way that a folder can be made if there isnt one or is there an extension for a file folder that i can use?
 
Spira said:
is there any way that a folder can be made if there isnt one?
I suggest you drop the DOS commands and use VBA. This code snipet will check if the directory exists and create it if it does not.
Code:
    If Dir("C:\MyBackups", vbDirectory) = "" Then
        MkDir ("C:\MyBackups")
    Else
        'do nothing for the "C:\MyBackups\" directory already exists
        MsgBox "C:\MyBackups\ directory already exists" 'for testing
    End If
Search the forum for "copy files" or "copy folder", etc. for code examples on how to do it with VBA. My first suggestion above will allow you to copy the database you are already in [while it is open].
 
Last edited:

Users who are viewing this thread

Back
Top Bottom