Link to home
Start Free TrialLog in
Avatar of Biggles1
Biggles1Flag for United States of America

asked on

Populate Access Table with names of documents in a folder

I have written Access VBA Code that opens a folder and displays all the documents in that folder.

QUESTION:

How do I use the FileSystemObject to populate a table with the document names?

I would greatly appreciate some help

Biggles1
SOLUTION
Avatar of danishani
danishani
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
capricorn1,

Have not use the FSO for a couple of years, but when I did, I generally found that it was quite a bit slower than just using DIR() to loop through the various folders and files.  Do you know if this is still the case?

@fyed- yes, i think that is one of the reason why i use Dir() in my recursive search code.
the link that danishani posted above http:#a36503477 have the recursive search codes
It'd help if you posted the code you have already.
I assume you have a FileDialog object on the go.
<opens a folder and displays all the documents in that folder>
And I suspect that the .Show is opening Windows Explorer window.

It's not that hard to take the vrtSelectedItem from that, and then do a GetFolder, GetFiles, and loop once through the Files collection, writing records to a table

The structure and name of the table would be nice to know too because the loop will be something like

dim rs as recordset
set rs = currentdb.openrecordset("select * from SomeTable where 1=2;",dbopendynaset)
for each myFile in myFiles
    with rs
       .addnew
       !PathName = vrtItemSelected
       !FileName = myfile.name
       .update
    end with
loop

But I can't do the syntax up without REALLY knowing what you have on the go.