Ciao,
facendo una ricerca in rete sono riuscito ad adattare il seguente codice per creare il backup del database.
In un modulo:
Declare PtrSafe Function apiCopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName
As String, ByVal bFailIfExists As Long) As Long
Sub CopyFile(SourceFile As String, DestFile As String)
'---------------------------------------------------------------
' PURPOSE: Copy a file in use on disk from one location to another.
' ACCEPTS: The name of the source file and destination file.
' RETURNS: Nothing
'---------------------------------------------------------------
Dim Result As Long
If Dir(SourceFile) = "" Then
MsgBox Chr(34) & SourceFile & Chr(34) & _
" is not valid file name."
Else
Result = apiCopyFile(SourceFile, DestFile, False)
End If
End Sub
In un pulsante:
Call CopyFile(CurrentProject.Path & "\Database.mdb", CurrentProject.Path & "\CopiaDatabase.mdb")
Quello che a me servirebbe, è creare ad ogni click del pulsante un backup nuovo, cioè che non si vada a sovrapporre a quello
già esistente.
Ad esempio CopiaDatabase1, CopiaDatabase2, CopiaDatabase3 ecc...
Vladimiro