Line Input #iNumOne, vTheFile

  • Thread starter Thread starter Bob Barnes
  • Start date Start date
B

Bob Barnes

I'm opening text files w/ code snippets of..

RA = "C:\SelfAud\TxtCheck\" & fname

Open RA For Input As iNumOne

Line Input #iNumOne, vTheFile

...where vTheFile (a variant) includes..
"090061",2009-05-07 00:00:00,"78","Open",2009-05-21 00:00:00,"No, employees
could not answer","Joe unaware of procedure ",,""

The issue is the comma after "No, ....

Line Input parses that so my code no longer works.

Is there another way of ensuring this sample vTheFile will parse as...
"090061"
2009-05-07 00:00:00
"78"
"Open"
2009-05-21 00:00:00
"No, employees could not answer"
"Joe unaware of procedure"

""

TIA - Bob
 
Hi Bob,

Last I knew, you have to read the entire line and do your own parsing,
checking to see if you are within quoted text or not.

I think that it may be easier to link to the file and read through the
table link. Or you could import the file into a work table. Either method
would make use of Access's built-in ability to do this kind of parsing.

Clifford Bass
 
"Line Input" will parse correctly until it encounters an "errant comma". The
comma in this scenario was accidentally entered into a Dropdown List from a
Table, after I asked the Designer of that Table to leave out any commas,
which he thought he had done. I "failed" to double-check for commas after I
was told there weren't any...definitely an error on my part.

The App runs on a Handheld using Visual CE. We can revise all those
Handhelds in the Field, but I'd like to be able to handle any "errant
comma(s)".

I'm hoping an Import Specification can do that, which I'll test in the
future as I'm on another Project now.

Thank you, Bob
 
Hi Bob,

You are welcome. It is always good to make sure your incoming data is
good--so, good for you for wanting to make sure the program can deal with it.
I have not tested lately, but Line Input may also fail when there are
embedded quotes in the fields. For example:

123,"He said, "Let's go!".",456

So whatever you do, you will want to make sure those do not cause a
problem also.

Clifford Bass
 
Clifford - thank you.

Years ago, I used io Import CSV files into Lotus 1-2-3.

Yes. a double quote embedded as in your example should fail.

CSV = anything between a set of double-quotes was a text...IE..
," Go Access Importing Go",

Something like..
,456, was the number 456...or
,, was no number.

Text files/ CSVs are cool.
 
Back
Top