Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to read in comma delimited file into Recordset?

Status
Not open for further replies.

ghost2

Programmer
Aug 7, 2003
145
US
I have a comma delimited file that has the first row is row headings. How can I read this into a recordset in VB6? This program was in Access 2K and the code was first creating a temp table. Thanks all
 
hmm!

you can open the file using 'OPEN', skip the first line.

Then start reading line by line and SPLIT the contents into an array : array = split(Line1, ","). Then array[0] will be the first column etc

Then just perform an insert or an update depends on the type of inserts your doing!

Hope that helps!

Nick
 
Try this:

Dim adoConn As New ADODB.Connection
Dim adors as new Adodb.Recordset adoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPath & ";" & _
"Extended Properties=""text;HDR=Yes;FMT=Delimited"""
adoRS.Open "Select * From " & strFile & "", adoConn, _
adOpenStatic, adLockReadOnly, adCmdText

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
Thanks DrJavaJoe. Have a great upcoming weekend.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top