Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Developer Toolkits / January 2005

Tip: Looking for answers? Try searching our database.

Backing up a back-end database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave Columbus - 15 Jan 2005 18:05 GMT
I am seeking advice on the best way to back up data contained in my back-end
database. I would like to do it from the front-end database, but I keep
getting errors that I believe are due to back-end access issues.

Any tips on how to develop a clean backup procedure?

Thanks in advance.
Douglas J. Steele - 15 Jan 2005 19:03 GMT
Make sure you don't have any open connections to the backend (no open bound
forms, that sort of thing).

What I typically do is run a little routine that renames the backend to a
backup file, then compact the renamed file to the name of the original
backend file. Apologies if there's word-wrap in what's below

Function CompactDatabase( _
  DatabaseName As String) As Boolean
' Renames the existing backend database
' from .MDB to .BAK
' Compacts the backup copy to the
' "proper" database
'
' Returns True if successful, False otherwise

On Error GoTo Err_CompactDatabase

Dim booStatus As Boolean
Dim strBackupFile As String

   booStatus = True

' Make sure that DatabaseName exists
   If Len(Dir$(DatabaseName)) > 0 Then

' Figure out what the backup file should be named
       If StrComp(Right$(DatabaseName, 4), _
          ".mdb", vbTextCompare) = 0 Then
           strBackupFile = Left$(DatabaseName, _
               Len(DatabaseName) - 4) & ".bak"

' Determine whether the backup file already exists,
' and delete it if it does.
           If Len(Dir$(strBackupFile)) > 0 Then
               Kill strBackupFile
           End If

           Name DatabaseName As strBackupFile

' Do the actual compact
           DBEngine.CompactDatabase strBackupFile, _
              DatabaseName
       End If

   End If

End_CompactDatabase:
   CompactDatabase = booStatus
   Exit Function

Err_CompactDatabase:
   booStatus = False
   DisplayError Err, "CompactDatabase"
   Resume End_CompactDatabase

End Function

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I am seeking advice on the best way to back up data contained in my
>back-end
[quoted text clipped - 4 lines]
>
> Thanks in advance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.