Filenaming

  • Thread starter Thread starter sdefl
  • Start date Start date
S

sdefl

Guest
I have a couple of Access processes.. that rely on a number of downloaded files. Instead of having the user copy the file to another directory and rename the file to filename+date of file created.dat... I want to do this in access...
original file name - Market.dat
file date created in windows explorer 9/25/2000
example of file new name automatically copied and renamed to a new directory- Market09252000.dat

Could you be explicit... This would be a huge time saver and save on user errors.
 
Hi,

you can do it one of two ways. If you want to copy the file ( and end up with 2 'versions' ) the use FileCopy. if you want to just move the file ( and have only one 'version' in the end then use Name.

for example;

FileCopy;

function CopyTheFile()

if dir(YourPathHere & "/Market.dat")<> "" then
'check the file exists before copying it
filecopy YourSourcePathAndFileName, YourDestinationPathAndFilename
else
msgbox "No file found error message bit"
end if
end function

Name example;

function MoveTheFile()

if dir(YourPathHere & "/Market.dat")<> "" then
'check the file exists before copying it
Name YourSourcePathAndFileName As YourDestinationPathAndFilename
else
msgbox "No file found error message bit"
end if
end function

HTH

Drew

- forgot this bit. You can generate a filename by using "Market " & format(now,"YYYYMMDDHHMMSS") or similar in the destination name

[This message has been edited by KDg (edited 12-27-2000).]
 

Users who are viewing this thread

Back
Top Bottom