Hi,
Is there a way to copy an open file ?
Like opening it for Read Only and copy it's contents ?
Thanks,
Alex Dybenko - 20 Nov 2005 16:59 GMT
Hi,
you can use api to do so, look here:
http://www.mvps.org/access/api/api0026.htm

Signature
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
> Hi,
>
> Is there a way to copy an open file ?
> Like opening it for Read Only and copy it's contents ?
>
> Thanks,
John Mishefske - 22 Nov 2005 07:09 GMT
> Hi,
>
> Is there a way to copy an open file ?
> Like opening it for Read Only and copy it's contents ?
No opinion on whether this is something you should do...
Private Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" ( _
ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long
' Replacement for FileCopy command that allows an open file to be copied.
' Of course - you want to be careful using this since any change to the
' file while copying it can leave the new copy corrupted.
'
' from http://support.microsoft.com/default.aspx?scid=kb;EN-US;207703
Public Sub CopyFile(SourceFile As String, DestFile As String)
'---------------------------------------------------------------
' PURPOSE: Copy a file on disk from one location to another.
' ACCEPTS: The name of the source file and destination file.
' RETURNS: Nothing
'---------------------------------------------------------------
Dim Result As Long
If Len(Dir(SourceFile)) = 0 Then
MsgBox Chr(34) & SourceFile & Chr(34) & " is not valid file name.", _
vbOKOnly Or vbExclamation, App.Title
Else
' important - don't allow a "copy over" - it may destroy data
Result = apiCopyFile(SourceFile, DestFile, True) ' 3rd param - FailIfExists
End If
End Sub

Signature
'---------------
'John Mishefske
'---------------
Alex Arkhipov - 18 Dec 2005 02:42 GMT
Try selecting everything and press Control+C.
> Hi,
>
> Is there a way to copy an open file ?
> Like opening it for Read Only and copy it's contents ?
>
> Thanks,