I came up against the problem of how to backup an open database yesterday. I read various threads here and on other sites on how to do this but none gave a working solution. So here is mine- for comment. Any improvements would be welcome.
In my case, the user is in a restricted interface and so cannot use the backup menu option. This has been tested on Access 2003:
In my case, the user is in a restricted interface and so cannot use the backup menu option. This has been tested on Access 2003:
Code:
Public Sub DBbackup()
Dim DestPath As String
Dim SrcPath As String
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
SrcPath = CurrentProject.Path & "\MyDB.mdb"
DestPath = CurrentProject.Path & "\BDbak" & Format(Date, "yymmdd") & Format(Time(), "hhmmss") & ".mdb"
fso.CopyFile SrcPath, DestPath
Set fso = Nothing
MsgBox "DB copied ", vbInformation, SBaviso
End Sub
Comment