View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default ADO & semicolon delimited text file?

Hi raj,

I think you'll have to use a schema.ini file to specify the format of the
text file you're opening. Here's a link to a similar thread that may help
to get you started:

http://groups.google.com/groups?hl=e...x .com&rnum=4

If you do a search on schema.ini and ado, you should find a lot of helpful
information.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


raj wrote:
Hello, I hope someone can help me with this issue, please.

I need to open a large semi-colon delimited text file into
a recordset using ADO.

Is this possible? If so, how do I make ADO aware that the
file is "semi-colon" delimited?

Right now, my code does not recognize this delimeter and
imports all the data into the recordset as one column
(NOTE: there are too many rows to open into a spreadsheet).

Your example code would be most appreciated, thanks in
advance.

If needed, my code so far is below:

Set cnText = New ADODB.Connection
cnText.CursorLocation = adUseClient
cnText.ConnectionString = "PROVIDER=MSDASQL;DRIVER=
{MICROSOFT TEXT DRIVER (*.TXT; *.CSV)};DBQ=" & argFilePath
& ";"
cnText.Open

strSQL = "SELECT * FROM " & argFileName & ";"
Set rsText = New ADODB.Recordset
rsText.MaxRecords = 0
rsText.Open Source:=strSQL, ActiveConnection:=cnText,
CursorType:=adOpenForwardOnly, LockType:=adLockReadOnly,
Options:=adCmdText

Your example code would be most helpful, TIA.