Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2016-08-17
7
Medium Priority
?
46 Views
Last Modified: 2016-08-18
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
Comment
Question by:Stephen Roesner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 75
ID: 41760316
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
 
LVL 26

Accepted Solution

by:
Nick67 earned 2000 total points
ID: 41760391
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
 
LVL 46

Expert Comment

by:aikimark
ID: 41760416
Of course, you would add rows into your table instead of msgbox
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
LVL 75
ID: 41760423
Nick already mentioned that "replace the msgbox's with good recordset code and you are there."

:-)
0
 

Author Closing Comment

by:Stephen Roesner
ID: 41761586
great code got it working perfectly thanks a lot
0
 
LVL 26

Expert Comment

by:Nick67
ID: 41761603
Excellent!
0
 
LVL 75
ID: 41761776
"as @mx said "
!
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question