PDA

Click to See Complete Forum and Search --> : Reading Tab Delimited File Using 'Input' Function


JonnyCab
Sep 10th, 2000, 01:30 AM
Using VB6 Pro.

I am importing data to an Access database from a text file. How do I skip the first 4 or so lines (File Header)?.

Also using the 'Split' function to split each line into fields so I can add to appropriate field in Access table.
eg Split(expression[, delimiter[, count[, compare]]])
How to I define the delimiter as a tab?

Any help would be appreciated

Cheers

Clunietp
Sep 10th, 2000, 05:30 PM
here is some ADO code that connects to a CSV file, it might make your life easier:

'Uses ADO 2.1/5

Dim cn As 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


You can use vbTab as the delimiter keyword

If you are using Input statements to read your data, you could just use 4 Line Input statements to skip the first 4 lines