Import File Information

Jan 16, 2018
Reaction score

I'm trying to Use access to load all the information of files I have on a server into one table.

SO if I have:
file "a" with create date "X1", description "Y1", tags "Z1"
file "b" with create date "X2", description "Y2", tags "Z2"
file "c" with create date "X3", description "Y3", tags "Z3"

I would like one table that has 3 rows and a column for each of these items. I've been able to somewhat create this with a module:

Option Compare Database

Sub GetFiles(strPath As String)
Dim rs As Recordset
Dim strFile As String, strDate As Date, strType As String, strTags As String

'clear out existing data
CurrentDb.Execute "Delete * From tblDirectory", dbFailOnError

'open a recordset
Set rs = CurrentDb.OpenRecordset("tblDirectory", dbOpenDynaset)

'get the first filename
strFile = Dir(strPath, vbNormal)
'Loop through the balance of files
'check to see if you have a filename
If strFile = "" Then
GoTo ExitHere
End If
strDate = FileDateTime(strPath & strFile)
strTags = FileTags
'to save the full path using strPath & strFile
'save only the filename
rs!FileName = strFile
rs!FileDate = strDate
rs!Tag = strTags

'try for next filename
strFile = Dir()

Set rs = Nothing
MsgBox ("Directory list is complete.")
End Sub

But i haven't figured out how to get tags, descriptions, subject, category, title, etc from each file to sit on the table. I don't really know how to finish the code, or the "calltags" for these items to appear. Any advice would help


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question