Automatically Back-Up Access 2002 DB

K

Kirstie Adam

All,

I am looking for some code, which i can plonk somewhere in my database, and
it will automatically backup (and hopefully compact) every morning at 1am.

Can anyone help?

Thanks,

Kirstie Adam
 
S

SteveD

I have done something like this ..... Here's the concept.

Using the windows task scheduler, create a task that opens
Access and a specific database (like when you create an
icon that opens a specific database). When this database
opens and your openning form, use the onOpen event (or
timer event), call a module that will compact your database
(s) to your 'saved' location, when completed then quit
your applciation.

Couple of notes: In code, you can not compact a database
to itself like you can when your in the database and use
the menu Tools / database utilities / compact.

You can copy and delete (kill) files as necessary with
code.
You can add a additional name to the compacted database
(like a date/time stamp) when you run the process.
You can build your module to cycle through a number of
databases.


I think this is what your after.

SteveD
PS: this may sound complicated, but if taken in small
steps, it's not.
 
S

Steve Heck

Actually, you can have the Compact command on your Windows
Explorer's right-click context menu. Simply copy this text
into Notepad and save it as compact.reg to add it to the
Registry and your context menu just double-click it. Then
select the file in Explorer, right-click and select
Compact from the drop-down. Please note that it is written
for Office Version 10. If you have a different version,
just edit the three places the version appears with
notepad to the correct version. Here's the code:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.mdb] "Content Type"="application/x-
msaccess"
@="Access.Application.10"
[HKEY_CLASSES_ROOT\Access.Application.10]
@="Microsoft Access Database"

[HKEY_CLASSES_ROOT\Access.Application.10
\Shell\Compact\command]
@="C:\\Program Files\\Microsoft
Office\\Office\\MSAccess.exe \"%1\"/COMPACT"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top