Do not use on any
shared computer
September 7, 2008 08:08pm pdt
 
[x]
Attachment Details

Access VBA Function to retrieve all file names in subdirectories with Date Created and Date Modified

Tags: Microsoft, Access, 2003
I need a VBA Function to retrieve all File Names in and below a directory root.  So if I browse to a folder root say S:\Office_Files\    A Text Box named TxtPath will contain  the value S:\Office_Files\

I click a button and a function  will return all files and paths at that root and in all subdirectories to a Table named Files.

The Files Table will contain the following Fields       Full_Path, Filename, DateCreated and DateModified.

How can this be done?  Thanks
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Software
Question Asked By: charming
Solution Provided By: puppydogbuddy
Participating Experts: 3
Solution Grade: B
Views: 267
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by puppydogbuddy

Rank: Genius

Expert Comment by puppydogbuddy:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Emil_Gray

Rank: Master

Expert Comment by Emil_Gray:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Emil_Gray

Rank: Master

Expert Comment by Emil_Gray:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by charming
Author Comment by charming:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by puppydogbuddy

Rank: Genius

Expert Comment by puppydogbuddy:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by puppydogbuddy

Rank: Genius

Accepted Solution by puppydogbuddy:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Open Discussion
Open Discussion
 
Comment by theclassic
How would you get the accepted solution to read out the list?  I am a begionner and trying to learn, thanks!
 
 
Comment by puppydogbuddy
I think all you need to do is add the following code after line 16 as shown below:  debug.print strTemp
As previously stated, I have access 2000, and can not test the code changes.

 Do While strTemp <> vbNullString
        colDirList.Add strFolder & strTemp
        strTemp = Dir
        Debug.Print strTemp                         '<<<<<<<<<<<<<<<<<<<<<  
Loop
 
 
Comment by theclassic
And this code is just placed in an aspx file on the server, on the main directory, and when you open it it gives a read out?  Where is the code for the presentation? Debug.Print str Temp?  Sorry, like I said I am new...
 
 
Comment by puppydogbuddy
the debug.print to the immediate window is one option you have.  For more options, click on the source link that I referenced for the source code in my first post, and you will find instructions for outputting the list:  
                http://allenbrowne.com/ser-59.html
This article illustrates how to list files recursively in VBA.
Output can be listed to the immediate window, or (in Access 2002 or later) added to a list box.

See List files to a table if you would prefer to add the files to a table rather than list box.

 
 
Comment by theclassic
Thanks, I will check this out...is there a way to tell when the page or file was last accesed also?  I know that is probably a seperate question, just thought i would ask, thanks!
 
 
Comment by puppydogbuddy
AFAIK, the Last accessed date is generally not available as a system level statistic.  You can, however, create that funcitonality at the application level or buy a 3rd party software designed for that purpose.
 
 
20080723-EE-VQP-34 / EE_QW_2_20070628