Loop through directory

C

Crystal

I need to loop through a specified directory and write the
filenames and pathnames of all the Access files found
there into a table. Is this possible? If so, how?

Any help would be greatly appreciated,
Crystal
 
D

Douglas J. Steele

Use the Dir function:

Dim strPath As String
Dim strFile As String

strPath = "c:\"
strFile = Dir(MyPath)
Do While Len(strFile) > 0
Debug.Print strFile
strFile = Dir
Loop

I'll leave it to you to figure out what to put instead of Debug.Print to
write the names to a table.
 

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