Solved

Access VBA loop through filenames

Posted on 2014-07-31
2
824 Views
Last Modified: 2014-07-31
From here: - http://www.dbforums.com/microsoft-access/1647035-loading-all-file-names-static-directory-ms-access-table.html
I modified to this: -
Dim strFileName As String
FileName = Dir("c:/EPOD/*.XML")
Do While FileName <> ""
    Debug.Print strFileName
    strFileName = Dir()
Loop
This prints out all the xml files in a folder but then errors "Run time error 5 Invalid Procedure Call or Argument"

Basically, I'm trying to process all the xml files in a given folder, can anyone help?
0
Comment
Question by:HKFuey
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
You're referencing "FileName", but your variable is "strFileName", so try this:

Dim strFileName As String
strFileName = Dir("c:/EPOD/*.XML")
Do While strFileName <> ""
    Debug.Print strFileName
    strFileName = Dir()
Loop

Open in new window

0
 

Author Closing Comment

by:HKFuey
Comment Utility
Thanks very much, glad it was easy!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now