Results 1 to 3 of 3
  1. #1
    Abdulaym is offline Advanced Beginner
    Windows 10 Access 2010 64bit
    Join Date
    Jul 2023
    Posts
    33

    Backing up Ms Access Database


    Is there any simple way to back up my Database apart from using storage medium like flash drive etc?

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    By chance did you mean "safe" and not simple? Using File Explorer to copy and save in the same folder is the simplest. It's also the least "safe". The further away from the location of the prime file the better if you want safe. Maximum safe means keeping at least one copy off site.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938
    I used to use this code from a switchboad menu form
    Code:
    Sub CreateBackup(Optional strDBType As String)
        Dim strDBpath As String, ext As String, tmp As String
        Dim strPath As String, strBackupPath As String, strDB As String
        
        
        'tmp = CurrentDb.Name    'or maybe this should be the name of your BE
        'strDBType = "FE"
        strDBpath = GetAccessBE_PathFilename("tbl-version_fe_master")
        strPath = Left(strDBpath, InStrRev(strDBpath, "\"))
        strBackupPath = strPath & "Backup\"
        
        'Will now backup front and back end database
        If strDBType = "FE" Then
            strDBpath = CurrentDb.Name
        End If
        strDB = Right(strDBpath, Len(strDBpath) - InStrRev(strDBpath, "\"))
        
        With CreateObject("Scripting.FileSystemObject")
            'ext = "." & .GetExtensionName(tmp)
            tmp = strBackupPath & Format(Now(), "yyyymmdd_hhnnss") & "_" & strDB
            .CopyFile strDBpath, tmp
        End With
        MsgBox strDBType & " Database saved as " & tmp
        
        
    End Sub
    
    Function GetAccessBE_PathFilename(pTableName As String) As String
    'strive4peace
    
    
       ' RETURN
       '  the file path and file name of the BE database
       '  "" if the table is not linked
       
       On Error GoTo Proc_Err
       
       Dim db As DAO.Database _
          , tdf As DAO.TableDef
       
       GetAccessBE_PathFilename = ""
       
       Set db = CurrentDb
       Set tdf = db.TableDefs(pTableName)
       
       If Len(tdf.Connect) = 0 Then
          GoTo Proc_Exit
       End If
       
       ' look at Connect string - Database Type is the first thing specified
       ' if the BE is Access
       If InStr(tdf.Connect, ";DATABASE=") <> 1 Then
          GoTo Proc_Exit
       End If
       
       GetAccessBE_PathFilename = Mid(tdf.Connect, 11)
        
    Proc_Exit:
       On Error Resume Next
       Set tdf = Nothing
       Set db = Nothing
       Exit Function
      
    Proc_Err:
       MsgBox Err.Description, , _
            "ERROR " & Err.Number _
            & "   GetAccessBE_PathFilename"
    
    
       Resume Proc_Exit
       Resume
                 
    End Function
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 13
    Last Post: 01-25-2021, 05:43 AM
  2. Backing up database
    By WAVP375 in forum Access
    Replies: 3
    Last Post: 04-08-2019, 11:20 AM
  3. Replies: 4
    Last Post: 05-31-2018, 12:16 PM
  4. Replies: 6
    Last Post: 08-08-2016, 06:42 AM
  5. Backing out of a split form
    By Reaper in forum Programming
    Replies: 9
    Last Post: 11-22-2011, 02:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums