FileCopy Problem

  • Thread starter Thread starter Josie
  • Start date Start date
J

Josie

Can someone tell why this code does not work:

Dim FromDir As String, ToDir As String
Dim Source As String, Target As String

ToDir = DLookup("PropertyPath", "MyFirm")
FromDir = DLookup("PhotoPath", "MyFirm")

Source = FromDir & "\test.jpg"
MsgBox Source - folder & file name shows correct

Target = ToDir & "\test.jpg"
MsgBox Target - folder & file name shows correct

FileCopy Source, Target

Nothing is copied

Thanks in advance

Josie
 
Josie,

The code below worked fine:

Private Function CopyMyFile()
Dim FromDir As String, ToDir As String
Dim Source As String, Target As String
FromDir = "C:\Test1"
ToDir = "C:\Test2"
Source = FromDir & "\1.bmp"
Target = ToDir & "\1.bmp"
FileCopy Source, Target
End Function

I can only assume that you have the directories the wrong
way round in your lookup table

Alastair
 
Alister

Thanks for the suggestion, re-looked at my code and found
that my code for the To folder was incorrect - the file
was always being copied - but into another folder!!

Josie
Had the code
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Why wont this code work 8
FileCopy problems 2
Filecopy problem 3
Folders not deleting immediately 5
Moving Files 4
problem with FileCopy function 1
Nant - Nunit2 configuration 1
NAnt for .net 2.0 1

Back
Top