The fact that the file cannot be copied by the FileCopy should be the first
warning that you shouldn't be copying the file! As I said elsewhere in this
thread, copying an open database is a risky proposition, as your copy could
very well be inconsistent.
And while I'm in a pedantic mood, could I suggest that you stop using HTML
for your posts? If you'll notice, my post was 3 KB: your reply to it was 11
KB, due to how much more verbose HTML posts are.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Doug,
Here's some information I found about copying files on a Microsoft website:
http://support.microsoft.com/default.aspx?scid=kb;en-us;207703
Respectfully,
Todd
Doug,
I have to be honest here--haven't tried the FileCopy function yet. However,
I do know how to code batch scripts--that's why I went this route.
Although, I am always open to the idea of using a different approach,
especially if its more effecient. Although, according to Ed's reply, it
appears that FileCopy cannot be used to copy the file currently
open--although I would like to test it myself. In contrast, I have used a
batch script to copy an open Access application. Although, I usually
instruct the user to wait before starting any read-write actions until the
copying is finished.
Best regards,
Todd
I'm curious, Todd, as to why you're recommending the round about way of
calling a batch file when VBA has a FileCopy command built into it.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Rocky,
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
hello all,
Please can someone tell me. how do you save the entire
database to a flash drive with code.
I use the flash drive to carry files to and from work so
that i can work on them at home.
but i can not find a way to do this with an access db.
Transferdatbase just let you transfer table, queries ect
not the whole db.
I can use exployer ie drag and drop but i would like to
have a button on a form and do it with code.
can this be done.
please note..i am fairly new to access.
thank you in advance.
Rocky Rhodes