Problem renaming a file from Access

lebrungr

New member
Local time
Today, 12:29
Joined
Feb 13, 2013
Messages
2
In a Microsoft Access module, I enter thru an input box a path for a directory in Explorer (C:\Data\Music\Renumbering) called SourceDir and also a Destindir (C:\Data/Music\Renumbering_1) and I import the name of several files. I renumber the files in a table in Access to be in a specific order.
When I try to rename the original files in the Source directory with the statement ( Name SourceDir & OldFileName As DestinDir & NewFileName)
I get the message file: File not found.
However If I redefine the SourceDir as follows : SourceDir = "C:\Data\Music\Renumbering\" and the DestinDir as "C:\Data\Music\Renumbering_1\" then the statement, Name SourceDir & OldFileName As DestinDir & NewFileName, works.
What should be in the Name statement to make it works with the SourceDir and DestinDir entered thru the Input box.
 
The error is probably happening in the first instance because of a missing bak slash, so the source file name is
C:\Data\Music\RenumberingFileName1.xxx

I'd suggest you test that the source and destination folder inputs have a trailing back slash, and if not add it.
 

Users who are viewing this thread

Back
Top Bottom