Do While Not EOF(1)
' Line Input #n reads an entire line.
Line Input #1, inString
' Input #n reads until it finds a comma.
Input #1, xName, xCity, xAmount
Loop
Close #1
Use a user defined type to read/write fixed width text from a file.
Private Type MyTable
Field1 As String * 5 'defines width of each field
Field2 As String * 10
Field3 As String * 12
End Type
Private Sub ReadFile()
Dim FileNum as Long
Dim OneRec as MyTable
FileNum = FreeFile
Open "C:\Whatever.TXT" For Random As #FileNum & _
Len = Len(OneRec)
Do Until EOF(FileNum)
Get #FileNum, ,OneRec
Validate (OneRec.Field1)
Validate (OneRec.Field2) 'and so forth
Loop
Close #FileNum
End Sub
To Write the data to the file, Open the file using the same open statement but use "Put" instead of "Get"
Depending on how you want to view it, the easiest would be to put a text box on a form, then append the text to the text box inside the do..while loop. If it's just for debugging probably having it open (or a copy of) in notepad would be fine.
yeah, but they would want the columns separating the fields. I thought about creating something along the line of a data screen so they could scroll through the data.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.