Hi there,
I am trying to automate copying a file from one place to another in Access.
The file name changes daily (the date) so it needs to build the file name. What I have looks like it SHOULD work, even hovering above the code I can see that everything is exactly as it should be. I can only think that there is a problem with using the date in the file name since access handles dates as a number.
Is there a way of converting the date to a string?
Would love anyones thoughs or possible sollutions....
The code:
Dim Day As Date
Dim startpath As String
Dim endpath As String
Day = Now()-1
startpath = "P:\Export\Scanners_" & format(Day, "mm") & "#" & format(Day, "dd") & "#" & format(Day, "yy") & ".txt"
endpath = "C:\Availability\Archives\Scanners_" & format(Day, "mm") & "#" & format(Day, "dd") & "#" & format(Day, "yy") & ".txt"
FileCopy "startpath", "endpath"
End Function
The error message is 'File not found'
Hovering above the startpath line shows that it is exactly what it sould be, the spelling and the file name are bang on?!?
I am trying to automate copying a file from one place to another in Access.
The file name changes daily (the date) so it needs to build the file name. What I have looks like it SHOULD work, even hovering above the code I can see that everything is exactly as it should be. I can only think that there is a problem with using the date in the file name since access handles dates as a number.
Is there a way of converting the date to a string?
Would love anyones thoughs or possible sollutions....
The code:
Dim Day As Date
Dim startpath As String
Dim endpath As String
Day = Now()-1
startpath = "P:\Export\Scanners_" & format(Day, "mm") & "#" & format(Day, "dd") & "#" & format(Day, "yy") & ".txt"
endpath = "C:\Availability\Archives\Scanners_" & format(Day, "mm") & "#" & format(Day, "dd") & "#" & format(Day, "yy") & ".txt"
FileCopy "startpath", "endpath"
End Function
The error message is 'File not found'
Hovering above the startpath line shows that it is exactly what it sould be, the spelling and the file name are bang on?!?