Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2007

Tip: Looking for answers? Try searching our database.

Loop through a directory

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SHIPP - 28 Sep 2007 16:34 GMT
How can I loop through a directory and put into a table the file name of say
anything that begins with abc*.txt? I am using Access 2003.
Signature

M. Shipp

Ken Snell (MVP) - 28 Sep 2007 16:44 GMT
Loop through a directory:

Dim strFile As String
Const strPath As String = "C:\YourFolder\"
strFile = Dir(strPath & "abc*.txt")
Do While strFile <> ""
   ' strFile contains the file name (e.g., abcFirstFile.txt)
   ' you can do what you want with it and strPath
   '    ( put code steps here )
   '
   '    ( end of your code steps )
   ' read name of next file
   strFile = Dir()
Loop

Do you know how to open a recordset and write data to a table?
Signature


       Ken Snell
<MS ACCESS MVP>

> How can I loop through a directory and put into a table the file name of
> say
> anything that begins with abc*.txt? I am using Access 2003.
SHIPP - 28 Sep 2007 17:16 GMT
Worked like a dream. Thank you.

Signature

M. Shipp

> Loop through a directory:
>
[quoted text clipped - 15 lines]
> > say
> > anything that begins with abc*.txt? I am using Access 2003.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.