?
Solved

Access VBA loop through filenames

Posted on 2014-07-31
2
Medium Priority
?
1,173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 40231358
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
ID: 40231422
Thanks very much, glad it was easy!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

762 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