Copy Whole Database

fsuhare

New member
Local time
Today, 00:37
Joined
Aug 20, 2002
Messages
6
I am trying to find a way to 'clone' my database on open. I have the autoexec macro forwarding to a module. I can not find any kind of method or script however to copy the whole database over. I will greatly appreciate any help or guidance available.

My job depends on it (just joking).
;)
 
Try this url:

http://www.mvps.org/access/api/api0026.htm

Additionally, you may want to compact your database before backing it up, here is an example of compacting code:

Function CompactDB()
'The following will compact the current Database
SendKeys "{F10}"
SendKeys "TDC"
End Function
 
To compact a database, you can use this type of code:
<<
Dim strFrom As String, strTo As String
strFrom = "C:\SomePath\SomeDB.MDB"
strTo = "C:\SomePath\AnotherDB.MDB"
DBEngine.CompactDatabase strFrom, strTo
>>

This creates a compacted copy with whatever name you want.

RichM
 
Thanks for the Link it was very helpful.

Thanks for the Link it was very helpful.
 
Here's another idea you could use to make a copy.

I've placed this code in the Form_Open event of my Main switchboard:

Private Sub Form_Open(Cancel As Integer)
Call Shell("C:\MYDOCS~1\COPIEA~1.BAT", 1)
End Sub

The contence of the BAT -file :

@echo off
copy C:\MYDOCS~1\\DB1.MDB C:\MYDOCS~1\BACKUP~1
cd c:\windows
@echo on

RV
 

Users who are viewing this thread

Back
Top Bottom