• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 47
  • Last Modified:

Read and load File names and date modified into a table from a FOLDER

In access vba  - I would like to go to a specific folder (No sub folders) and grab a list of file names and their date modified and date created and put them in a table in 3 columns - [Filename] [DateMod] [DateCreate]  -  any ideas?
I use  
       string = Dir(path & "*.*", vbnormal)
to get filenames all the time but how do u get the dates and other attributes and load them in a table?
0
Stephen Roesner
Asked:
Stephen Roesner
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
I just have a moment, but you can easily do this with the File System Object.
If you set a Reference to the VB Scripting Object ... you will have full intellisense.
0
 
Nick67Commented:
FilesystemObject as @mx said is your friend


Dim fs As Object
Dim myfile As Object
Dim myfolder As Object
dim mystring as string
Set fs = CreateObject("Scripting.FileSystemObject")
mystring  = "SomeValidPathToAfolder"
Set myfolder = fs.GetFolder(mystring))
For Each myfile In myfolder.Files
    Msgbox myfile.Path
    msgbox myfile.Name
    msgbox myfile.datecreated
    msgbox Myfile.DateLastModified
Next myfile

replace the msgbox's with good recordset code and you are there.
0
 
aikimarkCommented:
Of course, you would add rows into your table instead of msgbox
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Nick already mentioned that "replace the msgbox's with good recordset code and you are there."

:-)
0
 
Stephen RoesnerAnalysisAuthor Commented:
great code got it working perfectly thanks a lot
0
 
Nick67Commented:
Excellent!
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
"as @mx said "
!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now