Directory listed on a form :getting closer? (1 Viewer)

bodhran1

Dazed and Confused
Local time
Today, 06:24
Joined
Mar 27, 2002
Messages
43
Hi again all,

I posted a message late yesterday (~13 below)

I've gotten closer to seeing the files in my directory.

The following will read the list of files, display them one at a time, but each new filename overwrites the last one displayed.

Can I list them one below the other?

Please help!

I've spend days trying to figure this out.
---------------------------------------------
Dim myfile As String

myfile = Dir("x:\*.asc", vbNormal)

Do While Len(myfile) > 0
DoCmd.GoToRecord , , acNewRec
Forms![LOG_BACK]![test1] = myfile
myfile = Dir
Loop
 

cpod

Registered User.
Local time
Today, 05:24
Joined
Nov 7, 2001
Messages
107
I believe you wanted to list files in a directary in a listbox on your form? Go to the properties list for your listbox (I used the name "Test1" for the listbox in the code below) and change the "Row Source Type" to "Value List". The code below will list all files in the specified directory in the listbox name "Test1".

Dim strFile As String, strRowSource As String
strFile = Dir(directorypath)
strRowSource = strRowSource & strFile
Do Until strFile = ""
strFile = Dir
strRowSource = strRowSource & strFile & ";"
Loop
Me!test1.RowSource = Left(strRowSource, Len(strRowSource) - 1)
 

Users who are viewing this thread

Top Bottom