Displaying folder files in listview control

  • Thread starter Thread starter Ken Warthen
  • Start date Start date
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)
 
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
 
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
 
Back
Top