Biggles1
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
QUESTION:
How do I use the FileSystemObject to populate a table with the document names?
I would greatly appreciate some help
Biggles1
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@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("s elect * 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.
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("s
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.
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?