Full Version: List files in a folder...
UtterAccess Discussion Forums > Microsoft® Access > Access Q and A
lukesb
Hi

I am trying to list the contents of a folder in a combobox, but can't seem to find any help on this anywhere...

Can anyone help..?

Cheers

Luke
Alan_G
Hi Luke

Have a look in the VBA help files for FileSystemObject which will do what you want.

Please post back if you have any problems using it wink.gif
lukesb
Hi Alan

Sorry to be a pain, but I get keyword not found when I search for help on that. Would you give me a hand with this..?

Cheers..!

Luke
Larry Larsen
Hi Luke

Some thing like this:
CODE
Sub FileListDemo()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\")

For Each objFile In objFolder.Files
Debug.Print objFile.name
Next objFile

End Sub

thumbup.gif
Alan_G
Hi

Using Larry's code, you could build a comma seperated string to assign to the RowSource of your combo using a Value List as the row Source Type
lukesb
Excellent, thanks loads guys...

thumbup.gif

Luke
Alan_G
Glad we could help wink.gif
schitlipz
D'oh!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.