Results 1 to 5 of 5
  1. #1
    Kundan is offline Competent Performer
    Windows XP Access 2013 32bit
    Join Date
    Mar 2018
    Posts
    155

    Back up of back end


    How to backup the Back End containing the tables from the Front End through code?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    I have a tConfig table so the Admin user can enter the target folder saved to backup to.
    on the fAdmin form (tConfig table) , there is a button to click to copy:


    I have a table that is always in the backend, (tAlpha) for the
    getBeDbFromLink()
    if it has a string in the .CONNECT property, then the db is split,
    if not, it is a single unsplit Db.

    Code:
    sub btnBackup_Click()
       vSrcDb = getBeDbFromLink()
       If vSrcDb = "" Then vSrcDb = CurrentDb.Name
          'get the extension
       i = InStrRev(vSrcDb, "\")         
       If i = 0 Then 
          msgbox "Error in filename backup"
          exit sub
       else
          f = Mid(vSrcDb, i + 1)
       endif
       
       vExt = Mid(f, InStrRev(f, "."))
       vTargDir = me.txtTargetFolder   'get target folder from textbox
       vSuffx = "_Backup" & Format(Now,"yymmdd-hhnn")  & vExt
        vTargDb = vTargDir & f & vSuffx
       
     Copy1File vSrcDb, vTargDB
        
        msgbox "Backup Done"
    end sub
    
       'get the BackEnd database name from a linked table
    Public Function getBeDbFromLink()
    Dim vLink
        vLink = CurrentDb.TableDefs("tAlpha").Connect
        If vLink = "" Then
           getBeDbFromLink = CurrentDb.Name
        Else
           getBeDbFromLink = Mid(vLink, 11)
        End If
    End Function
    
      'copy file
    Public Sub Copy1File(ByVal pvSrc, ByVal pvTarg)
    Dim FSO
    Set FSO = CreateObject("Scripting.FileSystemObject")
    FSO.CopyFile pvSrc, pvTarg
    Set FSO = Nothing
    End Sub

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Just to explain this line in Ranman's code:
    Code:
    getBeDbFromLink = Mid(vLink, 11)
    That will remove the leading 'MS Access;' part of the connection string for an Access DB

    Of course this code isn't intended for & won't work as written for an ODBC database such as SQL Server or for linked spreadsheets etc.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #4
    Kundan is offline Competent Performer
    Windows XP Access 2013 32bit
    Join Date
    Mar 2018
    Posts
    155
    Quote Originally Posted by isladogs View Post
    Just to explain this line in Ranman's code:
    Code:
    getBeDbFromLink = Mid(vLink, 11)
    That will remove the leading 'MS Access;' part of the connection string for an Access DB

    Of course this code isn't intended for & won't work as written for an ODBC database such as SQL Server or for linked spreadsheets etc.

    Thanks a Lot!! GOD BLESS YOU!!!!!!!!!

  5. #5
    Kundan is offline Competent Performer
    Windows XP Access 2013 32bit
    Join Date
    Mar 2018
    Posts
    155
    Quote Originally Posted by isladogs View Post
    Just to explain this line in Ranman's code:
    Code:
    getBeDbFromLink = Mid(vLink, 11)
    That will remove the leading 'MS Access;' part of the connection string for an Access DB

    Of course this code isn't intended for & won't work as written for an ODBC database such as SQL Server or for linked spreadsheets etc.

    Is there any code for the above DBs?

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

Similar Threads

  1. Dating add back end
    By OrganicMC in forum Programming
    Replies: 4
    Last Post: 12-13-2017, 08:59 AM
  2. Replies: 5
    Last Post: 05-27-2013, 09:34 AM
  3. I'm back!
    By evander in forum General Chat
    Replies: 3
    Last Post: 02-27-2013, 08:29 PM
  4. Replies: 4
    Last Post: 05-21-2012, 08:21 AM
  5. Lock back-end DB with VBA
    By somm in forum Programming
    Replies: 5
    Last Post: 12-31-2010, 01:38 AM

Tags for this Thread

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