Re: ReadLine weirdness!
From: Neil Robertson (Robertson_at_discussions.microsoft.com)
Date: 08/06/04
- Next message: Katrina: "Shut Down Computer"
- Previous message: Abrm: "report settings in table"
- In reply to: John Nurick: "Re: ReadLine weirdness!"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 6 Aug 2004 04:53:03 -0700
Hi John,
Thanks for your reply, I'll try a few of those things later.
Interestingly, I changed my code to use Read and loop through the line
reading one character at a time instead of the whole line with Readline and
it worked perfectly.
I don't even begin to understand what might be going on here but I'll try a
few of your suggestions and report back.
Cheers
Neil
"John Nurick" wrote:
> Hi Neil,
>
> Curious. There's no obvious reason why this should happen, and my first
> instinct is to suspect your drive or file system. (BTW, I pasted your
> two lines into a textfile, and FileSystemObject.Readline read them both
> just fine.)
>
> What happens if you use Windows Explorer to make a copy of the file on a
> local drive? If you compare the copy with the original (e.g. by using
> the fc.exe command line utility)? Run a disk check? Try your code on the
> copy and not the original?
>
> If those tests reveal nothing, revise your code to use Open # and Line
> Input # instead of the FileSystemObject. What happens then?
>
>
>
> On Thu, 5 Aug 2004 05:07:02 -0700, "Neil Robertson" <Neil
> Robertson@discussions.microsoft.com> wrote:
>
> >Update: It's not returning spaces after the blank field. The ASC code for the
> >character it is returning is 0. According to the help file Windows does not
> >support this character yet I can see the line as it should be if I open it
> >into Notepad.
> >
> >Getting more confused by the second....
> >
> >"Neil Robertson" wrote:
> >
> >> Hi,
> >> I'm trying to read a CSV file into a database using the ReadLine method. Here is the code I've used:
> >>
> >> Dim fs, f
> >> Dim strLine As String
> >> Set fs = CreateObject("Scripting.FileSystemObject")
> >> Set f = fs.opentextfile(strSourceFile, 1, 0)
> >> strLine = f.readline
> >>
> >> If it reads the following line it works:
> >>
> >> 2,06730001,HODGE HILL COMPREHENSIVE SCHOO,LGL21902,07/07/2004,21,H,,Bromford Rd,BIRMINGHAM,West Midlands,,,B36 8HB,2093.32,366.33,2459.65,017.500,366.33,000.000,0.00,000.000,0.00, ,000.430,192.74,000.000,0.00,000.000,0.00,1425026100000,845,,127,00,I
> >>
> >> However if it reads the following line it doesn't:
> >>
> >> 2,06730002,HOLYHEAD LEISURE CENTRE,LGL21903,07/07/2004,21,H,,Florence Rd,Handsworth,BIRMINGHAM,West Midlands,,B21 0HN,2387.57,417.82,2805.39,017.500,417.82,000.000,0.00,000.000,0.00, ,000.430,218.77,000.000,0.00,000.000,0.00,1425186100009,845,,127,00,I
> >>
> >> With the second line, ReadLine returns the expected string up to the "0.00" just before the blank field. After that it returns a whole load of spaces and then the "I" at the end of the line.
> >>
> >> Any ideas what's going wrong here?
> >> Thanks
> >>
> >> Neil
>
> --
> John Nurick [Microsoft Access MVP]
>
> Please respond in the newgroup and not by email.
>
- Next message: Katrina: "Shut Down Computer"
- Previous message: Abrm: "report settings in table"
- In reply to: John Nurick: "Re: ReadLine weirdness!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|