Re: Backup Linked BE Tables
- From: "Brent Spaulding \(datAdrenaline\)" <datadrenaline@xxxxxxxxxxxxx>
- Date: Sun, 4 May 2008 23:23:15 -0500
Hello Mike P ---
What are you doing it in A2003 that is different in A2007? ...
......
Anyway, you can do this with an open file, but you wont be useing the new
file that is created. The following code is merely used just to back up the
back end ...
Public Sub BackupBE(strDestination As String)
Dim oFSO As Object
Dim strSQL As String
'Flush the cache of the current database
DBEngine.Idle
'Create a file scripting object that will copy the db. I use the
scripting
'object because the VBA.FileCopy will not work on an open file
Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.CopyFile _
Split(CurrentDb.TableDefs("ALinkedTableName").Connect,
";DATABASE")(1) _
, strDestination
Set oFSO = Nothing
'Compact the new file, ...
Name strDestination As strDestination & ".cpk"
DBEngine.CompactDatabase strDestination & ".cpk", strDestination
Kill strDestination & ".cpk"
End Sub
Hope that helps! ...
--
Brent Spaulding | datAdrenaline | Access MVP
"Mike P" <MikeP@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7349BE1C-1532-4FBC-940C-CE0458B1F7AE@xxxxxxxxxxxxxxxx
I have my database split into a FrontEnd (FE) containing all the modules,
forms, queries, etc., and a BackEnd (BE) containing all the tables. The
BE
is linked. I am trying to write some VB code that will automatically back
up
the BE when the user is running the application. This is working in
Access
2003 however, I am migrating to 2007 and when trying to backup the BE, I
get
an error that the "file is in use". which it is. This is a single user
system.
I am thinking I have to unlink the tables, backup the BE, then relink. but
have not figured out how to do this. So far the code I have is.
strTmpFileName = strBackUpDir & "\" & strFileName & ".accdb"
Application.CompactRepair strCurrentDB, strTmpFileName
It is failing on the Application.CompactRepair since the FE is connected
to
the BE I am trying to backup (and compactRepair while I am at it).
Any ideas?
Thanks,
Mike P.
.
- References:
- Backup Linked BE Tables
- From: Mike P
- Backup Linked BE Tables
- Prev by Date: Re: How can I replicate a BE database
- Next by Date: How to set up HTML in Body of Outlook programmatically.
- Previous by thread: Re: Backup Linked BE Tables
- Next by thread: Exclusive Lock msg on Database in Access 2007
- Index(es):