Got a slight problem with a file copy function in my System.
I have the following code in a separate module:
Then, in another form, I've got:
To call it with the variables stated.
If I put the brackets around the variable it says it's expecting an =, if I leave it as it is, it doesn't produce any errors, and seems to run, however it doesn't actually copy the file.
Also, if I put the code in the form itself, then other things go wrong which work perfectly without it.
This code USED to work fine and suddenly stopped?
Can anyone see what is wrong with it?
Thanks
I have the following code in a separate module:
Code:
Option Compare Database
Option Explicit
Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _
(ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long
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 Dir(SourceFile) = "" Then
MsgBox Chr(34) & SourceFile & Chr(34) & _
" is not valid file name."
Else
Result = apiCopyFile(SourceFile, DestFile, False)
End If
End Sub
Then, in another form, I've got:
Code:
CopyFile BackEndLocation, strFolderName & "BackEnd.mdb"
To call it with the variables stated.
If I put the brackets around the variable it says it's expecting an =, if I leave it as it is, it doesn't produce any errors, and seems to run, however it doesn't actually copy the file.
Also, if I put the code in the form itself, then other things go wrong which work perfectly without it.
This code USED to work fine and suddenly stopped?
Can anyone see what is wrong with it?
Thanks