Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Your stated problem does not require that you open multiple files for reading at the same time.



    Your stated problem was to cycle through all text files in a folder, find out how many records (lines) there are in each file, then write the result to a log (SQL or Access table). If that is not your objective restate it.

  2. #17
    Wasp1's Avatar
    Wasp1 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    21
    Yes....I still need to cycle through all text files in a folder, find out how many records (lines) there are in each file, then write the result to a log (Access table - tblData).

    My Point that I'm trying to make: My code Error at Set f = fs.OpenTextFile. (The error message is 450 Wrong number of arguments or invalid property assigned). How can I set F ?

  3. #18
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    If your stated goal hasn't changed why are you trying to open multiple files with a single line of code (other than it's impossible)?

    Think about how you would do this if you had 100 pieces of paper and each piece of paper had a random number of lines on it.

    You wouldn't spread the 100 pieces of paper on the ground and try to count all the lines on every sheet of paper at the same time.

    You'd look at the first sheet of paper, count the lines on it, then move to the next piece of paper and repeat the process. You are going to follow the same methodology in your code.

    Open Text file 1, count the number of rows, close text file 1, write the line count, file name, size, etc, to a log.
    Open Text File 2, count the number of rows, close text file 2, write the line count, file name, size, etc, to a log....

    continue for as many files as you have.

  4. #19
    casinc815 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2013
    Location
    Chicago, IL
    Posts
    46
    Wasp1:

    You question on how to account for multiple textfiles is already accounted for in the
    loop before the insert statement. If you want to loop through multiple files and count
    the records in each file that is a loop within a loop!!! You are looping through the textfile
    list in the direct and then looping through each text file to count the records.

    Good luck!

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. In need of UNIX text files for testing.
    By rpeare in forum Import/Export Data
    Replies: 2
    Last Post: 11-06-2012, 09:25 AM
  2. Transfer all text files in a specified folder
    By rtackett in forum Programming
    Replies: 4
    Last Post: 09-10-2012, 11:50 AM
  3. Transfer text files
    By raytackettsells in forum Import/Export Data
    Replies: 5
    Last Post: 09-08-2012, 12:37 PM
  4. Importing Text files
    By RayMilhon in forum Programming
    Replies: 4
    Last Post: 10-10-2011, 10:54 PM
  5. Cannot import excel or text files
    By donald_s in forum Access
    Replies: 2
    Last Post: 04-13-2010, 11:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums