Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File System as a Data Source

Status
Not open for further replies.

Thadeus

Technical User
Jan 16, 2002
1,548
US
Hello all,
quick background to question
In Crystal Reports there is the ability to create a report of the file system. I have used this method to create a report of my MP3 files and directory structure... I get to group by directory and display the details (MP3 files) below each directory.

actual question
Can Access do the same thing? That is, access the file system as a datasource? If so, what do I need to do?

Thanks,
~Thadeus
 
You'll need to use the VBA commands Dir, ChDir, ChDrive. You may be able to get away with just the Dir function.

Syntax: Dir[(pathname[, attributes])] with attributes being optional and pathname required (will accept wildcards.

Access Help says:

"You must specify pathname the first time you call the Dir function, or an error occurs. If you also specify file attributes, pathname must be included.

Dir returns the first file name that matches pathname. To get any additional file names that match pathname, call Dir again with no arguments. When no more file names match, Dir returns a zero-length string (""). Once a zero-length string is returned, you must specify pathname in subsequent calls or an error occurs. You can change to a new pathname without retrieving all of the file names that match the current pathname.
 
Access only deals with relational databases. The file system is heirarchical.

The Micrososft site has an Access application that uses VB Scripting FileSystemObject within VBA to read all the Access files in a file system. You can adapt that code to read all the files of all types. To find it maybe look under upgrading Access 97 - I think it was originally for you to see what 97 versus later mdbs you have.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top