By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,817 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

How to back up the data mdb using code (A2K3)

P: n/a
PW
Hi,

I need to back up the data mdb when our application boots up. I am
giong to use a table to make sure the data is backed up whenever the
application is started every 5 times (or something like that).

I have to get the path to where the data is (could be in the same
directory as the mde, or could be on a server or another PC).

I assume the data can't be backed up when it's in use/open?

And, I also need to code the actual backing up of the file.

Any suggestions?

-paulw
Mar 14 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Paul, you're correct in assuming that you cannot back up the database while
it is in use.

There is a way to back it up via the interface. In Access 2007, it's:
Office Button | Manage | Backup.
In code:
Runcommand acCmdBackup

However, it's not really safe to back up while the file is in use: if
someone changes the data, the copy would be inconsistent, not to mention the
potential issues with trying to back up while users or while a transaction
has records locked.

If you want to generate another file that has whatever current data is
available at the time (perhaps inconsistent, perhaps incomplete), this
example shows how it can be done:
http://allenbrowne.com/unlinked/backup.txt

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"PW" <pa**********************@removehotmail.comwrote in message
news:of********************************@4ax.com...
Hi,

I need to back up the data mdb when our application boots up. I am
giong to use a table to make sure the data is backed up whenever the
application is started every 5 times (or something like that).

I have to get the path to where the data is (could be in the same
directory as the mde, or could be on a server or another PC).

I assume the data can't be backed up when it's in use/open?

And, I also need to code the actual backing up of the file.

Any suggestions?

-paulw
Mar 15 '07 #2

P: n/a
PW
On Thu, 15 Mar 2007 11:54:08 +0900, "Allen Browne"
<Al*********@SeeSig.Invalidwrote:
>Paul, you're correct in assuming that you cannot back up the database while
it is in use.

There is a way to back it up via the interface. In Access 2007, it's:
Office Button | Manage | Backup.
In code:
Runcommand acCmdBackup

However, it's not really safe to back up while the file is in use: if
someone changes the data, the copy would be inconsistent, not to mention the
potential issues with trying to back up while users or while a transaction
has records locked.

If you want to generate another file that has whatever current data is
available at the time (perhaps inconsistent, perhaps incomplete), this
example shows how it can be done:
http://allenbrowne.com/unlinked/backup.txt
Great points, as usual, Allen!

-paulw
Mar 15 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.