Back up

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mclueless
    New Member
    • Jan 2008
    • 56

    Back up

    I am using vb6 and access and making an accounting software. How to code for back up...Pleae give me some idea
  • jagged
    New Member
    • Feb 2008
    • 23

    #2
    Originally posted by mclueless
    I 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

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      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

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        A couple of months back i have posted a reply to such a question with VB code . Try to find that .

        Comment

        • vinodkumarrao
          New Member
          • Feb 2008
          • 1

          #5
          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]
          Last edited by Killer42; Feb 25 '08, 10:42 PM. Reason: Corrected a couple of SMSisms

          Comment

          Working...