Clunietp
Aug 4th, 2000, 11:58 AM
here is how you connect to a CSV text file:
'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
Just loop through your recordset and insert the values into your MS Access table (you'll have to create a separate conneciton, of course)
'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
Just loop through your recordset and insert the values into your MS Access table (you'll have to create a separate conneciton, of course)