Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a native function for this within Access? Or would I have to do this with a batch script somehow?

Moreover, could I rename the files in a directory based on fields in an Access table?

share|improve this question
up vote 2 down vote accepted

See Dir function in VBA help to show you how to loop through a folder looking for files. Note that you must be in the VBA editor to search VBA help.

See the Name statement which "Renames a disk file, directory, or folder."

share|improve this answer

Is there a native function for this within Access? Or would I have to do this with a batch script somehow?

If you add the Microsoft Scripting Runtime as a reference you can use FileSystemObject from VBA. See here for some good examples.

Moreover, could I rename the files in a directory based on fields in an Access table?

You can do this with VBA.

share|improve this answer
    
Is there some reason you go for an outside library instead of recommending the built-in Dir() function? – David W. Fenton Jun 12 '11 at 19:52
    
@David W. Fenton - I thought that to rename files you needed FileSystemObject but as Tony points out you can use Name. So all the functionality is built into VBA. – ta.speot.is Jun 13 '11 at 0:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .