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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing MS Word Properties into Access table

Status
Not open for further replies.

bcooler

Programmer
Jun 13, 2009
132
Hello!

I am trying to eventually give users the ability to search on files based on certain file properties. To do so, I thought it best to figure out a way to import properties of a given set of folders (and any subfolders) into a table. The properties I would need are the File name (not the path), Title, Category, and Comments.

I would then do some searchable form that references this table.

My question is, "How do I ask Access to pull all that info into a table?"

I have looked on many websites and found a few hopeful ideas, but nothing that completely gets me there.
 
Thanks for responding!

Yesterday, I did find something closer to what I needed in a Microsoft scripting website (which works in Access also).

Code:
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace("C:\Binaries")
    For i = 0 To 34
        arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
    Next
    For Each strFilename In objFolder.Items
        For i = 0 To 34
            MsgBox arrHeaders(i) _
            & ": " & objFolder.GetDetailsOf(strFilename, i)
        Next
    Next

this message box'd all the info I need.

However, I still need it to go through each subfolder. I also need to append the info to a table. Any ideas?
 
The FileSystemObject folders collection ( or Access command Dir will allow you to iterate through subfolders.

It is generally not too difficult to build an Append query in VBA.

Code:
Set db = CurrentDB

s = "INSERT INTO ATable (Doc,Stuff) " _ 
  & "VALUES ('" & FileName & "','" & FileStuff & "')" 

db.Execute s, dbFailOnError

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top