[AccessD] Copy a file

Boogie Loogie boogieloogie at gmail.com
Thu Feb 23 18:12:41 CST 2006


Is there a File System Objects routine that displays the folders in a list
on the left and if I click on the folder displays the contents of the folder
in a list to its right? I have a home grown one but the File System Objects
is more prefessional looking than mine but I only can get the folders to
display.

Thanks

BL

On 2/23/06, Bill Patten <bill_Patten at earthlink.net> wrote:
>
> Here is routine that I use.
> Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _
>     (ByVal lpExistingFileName As String, _
>   ByVal lpNewFileName As String, _
>     ByVal bFailIfExists As Long) As Long
>   Declare Function SetFileAttributes Lib "kernel32" Alias
> "SetFileAttributesA" _
>     (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As Long
>
> Function BPCopyFile(SourceFile As String, DestFile As String, Optional
> intReadOnly As Integer) As Boolean
> On Error GoTo Err_BPCopyFile
>
> '----------------------------------------------------------------------------
> ' Purpose: Copy a file on disk from one location to another and on request
> change to or from readonly
> '   BPcopyfile "c:\dog.oub, c:\cat.mdb , optional 1 = readonly 2 = not
> readonly
> '   though this function will copy any files (open ones too) it was
> designed
> to copy a
> '   file from a CD, rename it and then make sure it is not read only
> ' By: Bill Patten, BPCS
> ' Date:     9/16/2003 8:41:58 PM
> ' Mods:
>
> '----------------------------------------------------------------------------
>   Const FILE_ATTRIBUTE_NORMAL = 128
>   Const FILE_ATTRIBUTE_READONLY = 1
>   Dim Result As Long
>   BPCopyFile = False 'Assume it wont work
>   If Dir(DestFile) <> "" Then ' desination file exist so kill it
>     'Just in case it is readonly and would not delete
>     Result = SetFileAttributes(DestFile, FILE_ATTRIBUTE_NORMAL)
>     Kill (DestFile)
>   End If
>
>   If Dir(SourceFile) = "" Then
>     MsgBox Chr(34) & SourceFile & Chr(34) & _
>       " is not valid file name."
>     Exit Function
>   Else
>     Result = apiCopyFile(SourceFile, DestFile, False)
>   End If
>   If Not IsNull(intReadOnly) Then
>     Select Case intReadOnly
>       Case 1  'Make file read only
>         Result = SetFileAttributes(DestFile, FILE_ATTRIBUTE_READONLY)
>       Case 2  'remove readonly
>         Result = SetFileAttributes(DestFile, FILE_ATTRIBUTE_NORMAL)
>     End Select
>   End If
>
> BPCopyFile = True
> Exit_BPCopyFile:
>   Exit Function
>
> Err_BPCopyFile:
>   MsgBox "Error " & Err.Number & ": " & Err.Description & " In Sub
> CopyFile
> In Module modFileCopy" & vbCrLf
>   Resume Exit_BPCopyFile
>
> End Function
>
>
>
>
> ----- Original Message -----
> From: "Reuben Cummings" <reuben at gfconsultants.com>
> To: "AccessD" <accessd at databaseadvisors.com>
> Sent: Thursday, February 23, 2006 10:12 AM
> Subject: [AccessD] Copy a file
>
>
> Anyone have a system setup to copy/move files?
>
> I want to give a client a small app that she can open, click a button and
> it
> will copy the specified file to another specified folder elsewhere on the
> network.
>
> Reuben Cummings
> GFC, LLC
> 812.523.1017
>
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list