twoplustwo
Registered User.
- Local time
- Today, 15:03
- Joined
- Oct 31, 2007
- Messages
- 507
Hey guys, hope you're all well.
I am importing a large text file via ADO. A given column contains both numeric and text values - these are identifiers for a product type. When I read the file to the recordset the first value sets the variant array field type (in this case double). The text value(s) are subsequently set to 0.
Anybody have any suggestions on how to fix? I originally parsed the whole file to an array but this took a while...
I don't actually need to loop through Field(4), I just wanted to view the results.
I am importing a large text file via ADO. A given column contains both numeric and text values - these are identifiers for a product type. When I read the file to the recordset the first value sets the variant array field type (in this case double). The text value(s) are subsequently set to 0.
Anybody have any suggestions on how to fix? I originally parsed the whole file to an array but this took a while...
I don't actually need to loop through Field(4), I just wanted to view the results.
Code:
Set cnConnection = CreateObject("ADODB.CONNECTION")
cnConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sInputFolder & ";" & _
"Extended Properties=""text;HDR=Yes;FMT=Delimited"""
Set rsRecordset = CreateObject("ADODB.RECORDSET")
With rsRecordset
.Open "SELECT * FROM " & sFileName, cnConnection, 3, 1, 1
lnRowCount = .RecordCount
varrInput() = .GetRows(lnRowCount)
.MoveFirst
If Not .BOF Then
Do While Not .EOF
Debug.Print .Fields(4)
.MoveNext
Loop
End If
End With