Re: Not able to ready tab delimited file correctly



On Dec 7, 9:11 pm, TECHFREAK <mamin...@xxxxxxxxx> wrote:
Hi,
I have following code and I am not able to read TAB Delimited file
correctly. I am getting full row as one record instead of field

==================================================
sFilePath = "C:\Orders\"
sFileName = "Order1.txt"
Dim Conn, rs
Set Conn = CreateObject("ADODB.Connection")
' Set the Dbq portion of the string to the physical folder where your
price files reside
Conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
sFilePath & ";Extended Properties='text;HDR=YES;FTM=TabDelimited'"
'Conn.Open "Driver={Microsoft Text Driver (*.txt;
*.csv)};Format=TabDelimited;HDR=YES;Dbq=" & sFilePath &
";Extensions=asc,csv,tab,txt;"
Dim sql
sql = "SELECT * from " & sFileName

Set rs = Conn.execute(sql)
While Not rs.EOF
Debug.Print rs(0) 'Here I get full row instead of one field which is
delimited by tab

'Debug.Print rs.fields.Item("LastName") & " <> ";
rs.fields.Item("FirstName") ' i get a error if I uncomment this code
althoug I have HDR=YES and Header name LastName and FirstName added
correctly
rs.MoveNext
Wend
================================
"Here is the data file i have used
LastName FirstName MiddleInitial
Myer Ken W
Poe Deborah L

Please help me what am I doing wrong.

Thanks
manoj



I forgot to mention, i am using Visual Basic 6.0

Thanks
Manoj
.