Populating a List box with files names

N

normad

I am using Access 97 and Windows 2000. I am trying to
populate a list box with the names of files in a specific
directory. I am fairly comfortable with Visual Basic. I
cannot use the FileSearch function because of the Access
97 and Windows 2000 combination. I can get a count of how
many files are in a directory, but I cannot get the code
correct to fill the list box. I am using the rowsource
but the box is still empty. I would appreciate any help
you can give me or any direction on where to go to look
for information.

Thank you,

Norma
 
C

Chris Nebinger

Dim strFile As String
strFile = DIR(PATHNAME & "\*.*")
lstBox.RowSource = ""
Do Until strFile = ""
If strFile <> "." and strFile <> ".." Then
lstBox.RowSource=lstBox.RowSource & strFile & ";"
End If
strFile = Dir
Loop


Chris Nebinger
 
N

NormaD

Chris:

Thanks! This works great.

Norma
-----Original Message-----

Dim strFile As String
strFile = DIR(PATHNAME & "\*.*")
lstBox.RowSource = ""
Do Until strFile = ""
If strFile <> "." and strFile <> ".." Then
lstBox.RowSource=lstBox.RowSource & strFile & ";"
End If
strFile = Dir
Loop


Chris Nebinger


.
 

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