Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Backup DB before purge

Status
Not open for further replies.

iXPhound

Technical User
Feb 25, 2001
146
0
0
US
Hi All:

I have a purge function that will erase all data in a database i am creating. However, prior to the code for purging data I want to backup the entire database (i.e. MyDB_Backup.mdb) However, I do not know how to write this. Any ideas are greatly appreciated!!! TIA!!!
 
The shortest way is to use DOS.
Write a BAT file with a copy on it. Do a macro command to run the bat file.
Firstly, compact your database to make sure that the backup is small and that the latest changes are included. Then run the macro.

Example

BAT FILE called COPYIT.BAT:
@cls
@echo off
copy Q:\database\Access97\InfoNET\InfoTest2K.mdb Q:\database\Access97\InfoNET\INFBKP.MDB

MACRO RunApp with command line as follows:
Q:\database\Access97\InfoNET\COPYIT.BAT

There may be a way to compact the database by running some code from the macro, but that's another story.

Another way is to write a routine to run through all the objects with a VBA routine and export them to an empty database, but that's another question too.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top