Solved

Access 2010 VBA Runtime error 424

Posted on 2012-04-10
2
794 Views
Last Modified: 2012-04-10
I'm trying to use the following code to move txt files to an archival directory.  But I get the attached error.

Dim strFolder As String
    Dim fso, txtFile
    strFolder = "C:\FTP\"

    txtFile = Dir(strFolder & "*.txt")

    While txtFile <> ""
      Debug.Print strFolder & txtFile
      txtFile.Move ("C:\FTP\Archive\")
      txtFile = Dir
     
    Wend
Untitled.png
0
Comment
Question by:JAMES125
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 37829473
Dim strFolder As String
    Dim fso, txtFile
    strFolder = "C:\FTP\"

    txtFile = Dir(strFolder & "*.txt")

    While txtFile <> ""
      Debug.Print strFolder & txtFile
     name strfolder & txtfile as "C:\FTP\Archive\" & txtFile
      txtFile = Dir
     
    Wend
0
 

Author Closing Comment

by:JAMES125
ID: 37829554
Aswesome, thanks again.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

726 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