I am using vb6 and access and making an accounting software. How to code for back up...Pleae give me some idea
Back up
Collapse
X
-
Originally posted by mcluelessI am using vb6 and access and making an accounting software. How to code for back up...Pleae give me some idea
Just copy the file to another directory or with another when your program exits, after you've closed all connections to the database...
FileCopy app.path & "\mydb.mdb" , app.path & "\mydb_backup.m db"
or use the FileSystemObjec t -
We often have questions here asking "how do I do a backup?". But the question is not as simple as it seems.
The first thing to do is work out what sort of backup strategy you want to follow. Things like what sort of backup (copy a whole database, copy selected records, incremental backup, etc etc), how often, where from, where to, how many copies, and so on. The technical details of how to do it are a comparitively minor consideration. The "where, why, how often" and so on will depend on the business, the type of data, the frequency of updates, and all sorts of factors.Comment
-
A couple of months back i have posted a reply to such a question with VB code . Try to find that .Comment
-
Hi,
The above code will show an error if the mdb you are trying to copy is opened ... You can try the below code which allows copying the mdb file though it is open...
[code=vb]
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" _
(ByVal lpExistingFileN ame As String, ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long
Private Sub Command1_Click( )
Dim lngResult As Long
Dim lngError As Long
Dim strSource As String
Dim strTarget As String
strSource = "C:\test\1\Emp. mdb"
strTarget = "C:\test\1\2\Em p.mdb"
lngResult = CopyFile(strSou rce, strTarget, lngError)
MsgBox "Succesfull y Copied to - C:\test\1\2"
If Err Then
MsgBox "Cannot copy", vbCritical
End If
End Sub[/code]Comment
Comment