PDA

Click to See Complete Forum and Search --> : Text File And ADO


Aug 7th, 2000, 10:57 AM
I have a CSV file called "olb.txt" with 5 fields. I created a User ODBC source called "TEST" with the fields defined as:

StartDate
StartTime
AppName
Agent
Duration

While I've successfully used ADO to connect to an Access database, I can't get ADO to connect to this ODBC file and keep getting the error message that the driver is unrecognized.

Can someone tell me how to setup the connection string?

Thanks.

JHausmann
Aug 7th, 2000, 11:48 AM
Ca you use the Jet "transferSpreadsheet" function to copy the table into Access and manipulate it from there?

rayed78
Aug 7th, 2000, 12:07 PM
If is of any help, check the preferences.

Clunietp
Aug 7th, 2000, 10:41 PM
Here is how you can connect to a CSV file without using ODBC or Automation:


'Uses ADO 2.1/5

Dim cn As ADODB.Connection
Dim rs As Recordset

Set cn = New Connection
Set rs = New Recordset

'open connection to folder that contains the CSV file
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\;Extended Properties=Text;"

'open the file
rs.Open "select * from test.csv", cn

'we have data
MsgBox rs.Fields(1).Value