Displaying folder files in listview control

K

Ken Warthen

I've been trying to figure out how to get the Active X listview control to
display a list of files in a folder, given the path of the folder on an
Access 2007 form. I've looked all over for samples and am striking out
everywhere I look. Any help will be greatly appreciated.

Ken Warthen
(e-mail address removed)
 
K

Ken Warthen

I figured out the following solution that seems to work.
....
strDirectory = strPath & "\"
intRC = 0
strFileName = Dir(strDirectory & "*.*")
Do While strFileName <> vbNullString
intRC = intRC + 1
fDate = Format((FileDateTime(strDirectory & strFileName)),
"mm/dd/yyyy")
With objlist
Set objItem = .ListItems.Add(, , strFileName)
objItem.ListSubItems.Add , , Nz(fDate, "")
objItem.ListSubItems.Add , , Nz(strPath, "")
End With
strFileName = Dir()
Loop
 
M

Maurice

Ken,

Great stuff, don't forget to put a clear statement in the beginning if you
want to start a new search...

objList.items.clear
 

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

Top