Re: Problem using FMT=Delimited to read comma delimited

From: Val Mazur (group51a_at_hotmail.com)
Date: 05/28/04


Date: Thu, 27 May 2004 22:03:47 -0400

Hi Gary,

Do you have Schema.ini file? You should have it to be able to load text file
properly. Inside of the Schema.ini you should specify delimiter and
datatypes of the columns

-- 
Val Mazur
Microsoft MVP
"Gary Jenovai" <Gary.Jenovai@kohls.com> wrote in message 
news:DBD3E466-E752-4500-9DED-AB632791D004@microsoft.com...
> 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: imbed Access query results (datasheet) into email body..
    ... add a reference to the ADO to your project (Microsoft ActiveX Data ... Dim cn As ADODB.Connection ... Dim html as String ... The best might be to use ADO to query the data, ...
    (microsoft.public.office.developer.outlook.vba)
  • RE: CDO.Person - Invalid Class String
    ... ' Reference to Microsoft ActiveX Data Objects 2.5 Library ... Dim sDestURL As String ... Private Sub cmdSaveMsg_Click ... Set iDsrc = OrigMsg ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Run an Access Query from Excel VBA with Parameters
    ... check Microsoft ActiveX Data Objects ... Dim cn As ADODB.Connection ... Dim prm As ADODB.Parameter ...
    (microsoft.public.excel.programming)
  • Re: database query to upload a dbf file
    ... Sub piloterDBase_jointureBases ... 'activate Microsoft ActiveX Data Objects x.x Library ... Dim Cn As ADODB.Connection ... 'the dbf bases are supposed in the same directory ...
    (microsoft.public.excel.programming)