Re: ReadLine weirdness!
From: John Nurick (j.mapSoN.nurick_at_dial.pipex.com)
Date: 08/05/04
- Next message: Bill: "From Access Automate Excel to transfer cell values to form controls - possible?"
- Previous message: J: "Connecting via File DSN?"
- In reply to: Neil Robertson: "RE: ReadLine weirdness!"
- Next in thread: Neil Robertson: "Re: ReadLine weirdness!"
- Reply: Neil Robertson: "Re: ReadLine weirdness!"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 05 Aug 2004 22:37:37 +0100
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: Bill: "From Access Automate Excel to transfer cell values to form controls - possible?"
- Previous message: J: "Connecting via File DSN?"
- In reply to: Neil Robertson: "RE: ReadLine weirdness!"
- Next in thread: Neil Robertson: "Re: ReadLine weirdness!"
- Reply: Neil Robertson: "Re: ReadLine weirdness!"
- Messages sorted by: [ date ] [ thread ]