What hack has written is pretty much what I use. It checks to see if a folder exists with today's date on it, if it doesn't then it makes it and copies the files. It doesn' t matter if they are in use, although obviously any changes which haven't been updated yet won't be saved.
The function can be triggered manually or with a timer
Here is the code
PHP Code:Public Function MDbackupdatabases() As Long
Dim DBname$(5)
Dim oldfolder$
Dim newfolder$
Dim t&
Dim fso As Object 'As New scripting.FileSystemObject
Set fso = CreateObject("Scripting.FileSystemObject")
oldfolder = "T:\"
newfolder = "T:\DBbackups " & format(Date, "ddMMyy")
retval = MDcreateFolder(newfolder)
If retval Then 'folder did not previously exist
DBname(0) = "Contacts2000.mdb"
DBname(1) = "Project2000.mdb"
DBname(2) = "newindexes2000.mdb"
For t = 0 To 2 'cycle through all files
fso.copyfile oldfolder & DBname(t), newfolder & DBname(t), False 'false means will not overwrite
Next t 'cycle through all files
MDbackupdatabases = 1
End If 'folder did not previously exist




Reply With Quote