Solved

Reading From a text file

Posted on 2003-11-05
3
366 Views
Last Modified: 2012-05-04
This is a somewhat stupid question... How do I read from a text file?

I have a tab delimited text file and I need to read in line by line the file.

I can not directly import the file because I need to make modifications to the fields.

   - Marc
0
Comment
Question by:MarcGraff
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 250 total points
ID: 9690521
Dim strData As String

Open "C:\file.txt" For Input As #1
Do Until EOF(1)
    Line Input #1, strData

    'strData now contains the line of data - process as needed
Loop
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 9690527
Oh, don't forget a "Close #1" (minus the quotes) after the loop to close the file.
0
 
LVL 1

Author Comment

by:MarcGraff
ID: 9691473
Thanks!

   - Marc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2003, my txt file export is running backwards 4 47
passing parameter in sql procedure 9 57
MS Date Picker 64 bit 32 bit issue 12 50
Spell Check in VB6 13 99
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

863 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

27 Experts available now in Live!

Get 1:1 Help Now