Hi,
Somebody posted a while ago a method by which you can copy a .mdb file even if it is in use.
I can't find that thread.
Does anyone know how to do it?
Printable View
Hi,
Somebody posted a while ago a method by which you can copy a .mdb file even if it is in use.
I can't find that thread.
Does anyone know how to do it?
I believe the CopyFile method of the FSO allows you to copy an open file. Very useful for backups when the db is open. :)
You can also use the CopyFile API function and avoid the bulky FSO.
VB Code:
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long Private Sub Form_Load() CopyFile "C:\My Documents\Greenvil.mdb", "C:\My Documents\aaaa.mdb", True End Sub
Will the api function copy it even though it is open?
It's an mdb file.
Thanks a lot guys.
I'm aware of the CopyFile API but can find no documentation which states it will work on a file that is currently open. Does it?
Yes I tried it before I posted the solution.Quote:
Originally posted by vbgladiator
Will the api function copy it even though it is open?
It's an mdb file.
Thanks a lot guys.