Well - here is an approach I used in the past.
1. Backup of open database - I created a copy of the database and coded my own psuedo replication routine that would "Transfer" the data to the replica database.
2. For backing up - you can create a seperate database file that has an autoexec macro. The macro can call a routine where you Copy the file & Compact it to another directory.
htwh Steve Medvid
"IT Consultant & Web Master"
Function CopyFile(SourceName As String, DestName As String) As Integer
'
' Copies a single file SourceName to DestName
'
' Calling convention:
' X = CopyFile("C:\This.Exe", "C:\That.Exe"
' X = CopyFile("C:\This.Exe", "C:\Temp\This.Exe"
'
Const BufSize = 8192
Dim Buffer As String * BufSize, TempBuf As String
Dim SourceF As Integer, DestF As Integer, i As Long
On Error GoTo CFError
SourceF = FreeFile
Open SourceName For Binary As #SourceF
DestF = FreeFile
Open DestName For Binary As #DestF
For i = 1 To LOF(SourceF) \ BufSize
Get #SourceF, , Buffer
Put #DestF, , Buffer
Next i
i = LOF(SourceF) Mod BufSize
If i > 0 Then
Get #SourceF, , Buffer
TempBuf = left$(Buffer, i)
Put #DestF, , TempBuf
End If
Close #SourceF
Close #DestF
CopyFile = True
CFExit:
Exit Function
CFError:
Close
MsgBox "Error " & Err.Number & " copying files" & Chr$(13) & Chr$(10) & Error
CopyFile = False
Resume CFExit
End Function
You have to change the Path of the source file to Your DB Path in (C:\YourPath\YourDB.mdb) and then copy to were do you want (C:\YourPath\DBCopy.mdb)
Best Regards
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.