Here's the only way I know how to do it. First create a public function in a
module that will have VBA code that will do the backup, then create a macro
that uses the RunCode command, with the name of your backup function as the
function name for RunCode. Your button would point to the macro. You need to
include brackets when you specify the function name, e.g. if your backup
function is called CreateBackup then for Function Name in the macro you would
have CreateBackup(). I don't know of any Access commands that will create a
backup - pretty sure you have to do this with VBA. Here's a sample of what
the funciton would look like:
Public Function CreateBackup() as Boolean
Dim FSO As FileSystemObject
Set FSO = New FileSystemObject
If FSO.FileExists(DBFileName) Then
FSO.CopyFile dataFileName, backupFileName, True
CreateBackup = True
Else
CreateBackup = False
Msgbox "The file you are trying to back up does not exist."
End If
End FUnction
You need to specify the file names for your file to be backed up and the
file name you want for your backup. You'd also need to add 'standard' error
handling (an On Error GoTo... or however you handle your errors).
I think for the file system objects you need to add a reference (In VBA,
goto Tools, References). I think you need to have a reference for Windows
Script Host Object Model. Hope this helps.
Jim B