Problem using FMT=Delimited to read comma delimited

From: Gary Jenovai (Gary.Jenovai_at_kohls.com)
Date: 05/27/04


Date: Thu, 27 May 2004 09:01:07 -0700

One of our developers is using ADO with FMT=Delimited to read a comma delimited file. It works fine except for any fields that begin with "KK". The KK is not returned. For example a file AA, 2213, KK2310 would return AA, 2213, 2310. It seems that KK must trigger it as some sort of designation, causing the KK not to returned. I've included the code below. Project references needed are Microsoft ActiveX Data Objects Recordset 2.6 Library and Microsoft ActiveX Data Objects 2.6 Library (we've tried this with ADO 2.5, 2.6, and 2.7, all same results). Any suggestions on how to cause the KK to be read would be appreciated. Here's the code:

Private Sub Command1_Click()
Dim connCSV As New ADODB.Connection
Dim rsTest As New ADODB.Recordset
Dim adcomm As New ADODB.Command
Dim path As String

path = "C:\" 'Here Test dir is the Directory where
' the text file is located. don't write the file name here.

'This is connection for a text file with Header (i.e., columns
 
'connCSV.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" _
'& path & ";Extensions=asc,csv,tab,txt;HDR=NO;Persist Security Info=False"
'
 connCSV.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=" & path & ";" & _
          "Extended Properties=""text;HDR=YES;FMT=Delimited"""
 
 
    
rsTest.Open "Select * From test.txt", _
       connCSV, adOpenStatic, adLockReadOnly, adCmdText

Do While Not rsTest.EOF
MsgBox rsTest(0) 'Selecting the data
MsgBox rsTest(1)
MsgBox rsTest(2)
rsTest.movenext
Loop

'How come the data KK1210 doesn't get returned
'rsTest(2) only brings back 1210
'SAVE THE FOLLOWINT TO C:\TESTDIR\TEST.TXT
'AND RUN THE ABOVE CODE

'Name,Code,StyleID
'John,KK,KK1210

End Sub



Relevant Pages

  • Re: Playing AVI and MPEG using MCI
    ... "mciSendStringA" (ByVal lpstrCommand As String, ... Dim mlRet As Long ... Private Sub CenterObject ... If mlRet 0 Then ...
    (microsoft.public.vb.controls)
  • Change this Program
    ... Private sPathFrom As String ... Private Sub enableControl ... Dim oColor As OLE_COLOR ... Dim sPathTo As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Error when running vb app with FlexGrid control
    ... Private Sub cmdNetChange_Click ... On Error GoTo Command1_Click_Error ... Private Sub fnGetData(strParam0 As String, strParam1 As String, FLX As ... Dim rsADOObject As Recordset ...
    (microsoft.public.vb.general.discussion)
  • Sum in a dynamic query
    ... Private Sub Form_Open ... Dim db As Database, Tbl As TableDef ... Dim db As Database, qd As QueryDef, ctl As Control, s As String, Item As ...
    (comp.databases.ms-access)
  • Re: How to add/load records to combobox ?
    ... Dim rsCustomers As New ADODB.Recordset ... Private msCustomerIDsAs String ... Private Sub Combo1_Click ... Dim sSQL As String ...
    (microsoft.public.vb.controls)