Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access XP (Stepping through files in Directory Folder)

    In a module in Access XP I need to create a sub that will step through the files in a folder and grab the file names (this is the short version, I can handle it from there). I am assuming that the file system object will be involved, but how do I set up a loop where I'm stepping through each file in a named folder and grabbing its name property?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Access XP (Stepping through files in Directory

    The code posted HERE is for Excel, but it should also work for Access.
    Legare Coleman

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Access XP (Stepping through files in Directory Folder)

    Unless you have a need to use the FileSystemObject, the Dir function used in the code link Legare posted is entirely adequate. If you're searching for a file, on the other hand, FileSystemObject is definitely the way to do it.
    Charlotte

  4. #4
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    NYC,USA,Earth
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Access XP (Stepping through files in Directory Folder)

    The FileSystemObject model contains a folder object which includes a files collection. Using a For Each loop you can loop through each file object in the folder's files collection and get the file's name property.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Serbia and Montenegro (Yugoslavia)
    Posts
    342
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Access XP (Stepping through files in Directory Folder)

    I forgot about that, thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •