Just answered a similiar question--I usually use a batch script (it will copy the file even if its open). However, I also have a Microsoft reference that discusses this topic as well.
Here's the Microsoft reference:
http://support.microsoft.com/default.aspx?scid=kb;en-us;207703
Otherwise....
You can call a batch script using a command button that would copy your file. A batch file is coded using the DOS language.
STEP 1) Copy the following, open Notepad, and paste the code inside. Save the file as Backup.bat and be sure to save it in the same folder as your application.
======== Copy Here =========
@@echo off
echo.
echo ===============
echo STARTING BACKUP
echo ===============
echo Please standby...
ping localhost -n 3 > nul
::Edit the Location for your File and Where to Backup
xcopy /q/y/c/e "C:\Program Files\ApplicationName\ApplicationFile.mdb" "E:\Backups\*.*" > nul
cls
echo.
echo Backup Complete! Standby...
ping localhost -n 3 > nul
======== End Here =========
STEP 2) Copy the following code and paste it into a button's OnClick event:
'=========================================
'DATE:
'AUTHOR:
'COMMENTS:
'
'1) This subroutine launches a MS-DOS
'batch script to perform a backup of
' the application.
'=========================================
'DECLARING VARIABLE
Dim strAppName As String
'INITIALIZING VARIABLE (EDIT THE LOCATION OF THE BATCH FILE IF NEEDED)
strAppName = "C:\Program Files\ApplicationName\Backup.bat"
'CALLING MS-DOS BATCH SCRIPT TO PERFORM APPLICATION UPDATE
Call Shell(strAppName, 1)
STEP 3) Test the button and make sure it works!
Best regards,
Todd
Hi Rosco,
Thanks for that code. Have tried it and it works fine if the backend is not
already open.However, if I put this on my form the DB will be open always.
Thanks
Les