How to backup tables aside from copying *.mdb file ?

  • Thread starter Thread starter Guest
  • Start date Start date
Why? Copying the MDB file is certainly easier.

You could, I suppose, loop through all the non-system tables and use the
TransferDatabase method to copy them to another database. Untested air-code:

Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef
Dim strDatabase As String

strDatabase = "C:\Folder\File.mdb"
If Len(Dir(strDatabase) = 0 Then
DBEngine.Workspaces(0).CreateDatabase strDatabase
End If

Set dbCurr = CurrentDb()
For Each tdfCurr In dbCurr.TableDefs
If (tdfCurr.Attributes And dbSystemObject) = 0 Then
DoCmd.TransferDatabase acExport, "Microsoft Access", _
strDatabase, acTable, tdfCurr.Name, tdfCurr.Name
End If
Next tdfCurr
 
Copying the MDB file is certainly easier.

But not reliable if the file is in use.
You could, I suppose, loop through all the non-system tables and
use the TransferDatabase method to copy them to another database

Has anyone ever been able to run Lyle's SysCmd 6 backup from
anything other than the MDB you're attempting back up?
 
David,
Do you know of any method of backing up an Access mdb file that is reliable
if the file is in use? I don't

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Do you know of any method of backing up an Access mdb file that is
reliable if the file is in use? I don't

Depends on what you mean by "reliable." A file copy is not reliable
because you have no idea if the result will be in a consistent state
internally.

But a copy using Jet commands will result in a copy that is
internally consistent up to the time that Jet got read locks on each
object being copied. That seems to me to be good enough. The
TransferDatabase method would be one such method, as would Lyle's
SysCmd 6.

Now, if you mean "an exact copy of all the data I saw in my MDB when
I had it open in Access at the time I made the copy" then, no, you
can't 100% reliably copy that file.

But I think only idiots would want that kind of copy (what do you
want a copy for, anyway, other than backup?).
 
Back
Top