Backing Up Back End from Front End

  • Thread starter Thread starter dennis g
  • Start date Start date
D

dennis g

Guest
Access 97. Split database. Back end is on network drive and is password protected. I want to initiate some kind of process from the front end (say when a user opens a certain form or clicks a certain button) that will create copies of three of the tables in the back-end and place the copies in a different folder on the network drive. I thought I had this licked, using the CopyObject command, then discovered I was only making copies of the links. I can't point the CopyObj command at the back-end tables. Any ideas?
 
Wait, I figured out most of this. Now, I can't find a way to pass the password to the back_end so the user doesn't see it or is prompted for it. I have placed the actual back-up code in the back end, activated by a macro. From the front end I am only calling the back-end in a new instance of Access. It all works except for the password. Anyone out there done this before?
 
Here is a copy of a SubRoutine that I built a while back that you may can alter to your needs. This does not extract each table, but instead make a complete backup of the Backend db.

Public Sub BackUp97()
On Error GoTo Err_Backup
Dim db As Database
Dim strSource As String, strDest As String, strError As String
Dim strMsgComplete As String, strTitleComplete As String
Dim strInPutMsg As String, strInputTitle As String

strInPutMsg = "Enter Complete Path to Save Backup File"
strInputTitle = " Enter Location for Backup"
strMsgComplete = "The Database was Sucessfully Saved to the Location Chosen."
strTitleComplete = " Backup Complete"

BeginBackup:
Set db = CurrentDb()

' Path where backend database is located
' Change Path and File Name to your needs
strSource = "C:\YourFolderName\YourBackEnd.mdb"

' Destination where data file is to be copied
strDest = InputBox(strInPutMsg, strInputTitle)

DoCmd.Hourglass True

FileCopy strSource, strDest

db.Close

DoCmd.Hourglass False

' Backup has completed - Give Successful Completion Message
MsgBox strMsgComplete, vbInformation + vbOKOnly, strTitleComplete

Exit_Backup:
  Exit Sub

Err_Backup:
  Select Case Err.Number
    Case 61
      strError = "The Disk is full, Cannot Save to this Disk." _
& vbCrLf & vbCrLf & "Insert a New Disk then Click ""OK"""
      MsgBox strError, vbCritical, " Disk Full"
      Resume BeginBackup
    Case 70
      strError = "The File is currently open." & vbCrLf & _
      "The File can not be Backed Up at this time."
      MsgBox strError, vbCritical, " File Open"
    Case 71
      strError = "There Is No Disk in Drive" & vbCrLf & vbCrLf & _
      "Please Insert Disk then Click ""OK"""
      MsgBox strError, vbCritical, " No Disk"
      Resume BeginBackup
    Case 75
      strError = "Invalid Path Error" & vbCrLf & vbCrLf & _
      "Check Path and File and try again"
      MsgBox strError, vbCritical, " Invalid Path Error"
      Resume BeginBackup
    Case 76
      strError = "You Clicked Cancel Operation" & vbCrLf & vbCrLf & _
      "Click ""OK"" to Continue."
      MsgBox strError, vbInformation, " Cancel Operation"
    Case Else
      Err.Raise Err.Number, Err.Description
      Resume Next
  End Select

  DoCmd.Hourglass False
  Resume Exit_Backup

End Sub

HTH
RDH

[This message has been edited by R. Hicks (edited 11-23-2001).]
 

Users who are viewing this thread

Back
Top Bottom