Does anyone know of a way to copy a database file that is currently open? The Filecopy command from VB returns an error when you use it on an open file.. but if you copy a file manually through windows if it's currently open, it will work. Any suggestions would be greatly appreciated. Thanks.
[cringe]
I hate doing things this way, but it might work...
...You could run a batch (.bat) command file that carries out the copy operation.
If you need it to be dynamic (i.e. to copy to a different location each time, you would need to generate the .bat file dynamically in code using Print# to put the correct file/path names in there.
This method is going to have a problem with long names though...
[/cringe]
I tried experimenting with the sendkeys to stop the prompt for file or folder but couldn't get it to work. Someone with WSH knowledge should be able to figure that part out though.
Anyway, I thought I would send this along just in case you were still looking for another way.
Thanks, but Mike's idea is actually going pretty well... I already am going through a loop of databases to backup... So I just overwrite a batchfile and run it in the loop.. I'm sure this probably eats up memory, but I only have about 20 databases or so and only run it about once a week... So I think it should be fine... Thanks again for all the help...
Then other applications can tell whether the database is open or not, more specifically, they can test whether it has just closed (because the 'done file will be there) and the backup can be done, so you can take the backup operation outside the main application.
of course, this can be done by just testing for the .ldb file, but the advantage of doing it my way is that (assuming your backup application tests for the presence of a 'done' file, then deletes the 'done' file after doing the backup), the application gets backed up every time it has finished being used.
HTH
Mike
[This message has been edited by Mike Gurman (edited 07-11-2001).]