Using Office 2003 is there a VBA equivalent in Access to Excel's
"SaveCopyAs" command, which saves a copy of the currently open file to
a destination folder, but keeps the current file active?
you could probably do something like this _completely_ untested air code:
' make a new mdb to copy into
set backupdb = CreateDatabase("g:\mybackup.mdb", etc)
backupdb.Close
' handle to currently open db
set cdb = CurrentDB()
' iterate the local tables
for each tdf in cdb.Tabledefs
' ignore the system tables; I doubt the value is
' correct but you can check that in the help files
if tdf.Attributes AND acSystemTable = 0 then
' do the copy command: look up help on the IN clause
jetSQL = "SELECT * " & _
" INTO " & tdf.Name & " IN [g:\mybackup.mdb]"
" FROM " & tdf.Name
' and carry it out
cdb.Execute jetSQL, dbFailOnError
end if
next tdf
but there might be inconsistencies if anyone is using the database at the
time. You won't get the relationships in either, but that's okay because
(a) they might be invalid and (b) they can be reconstructed if you ever
need to recover the backup.
Hope it helps
Tim F