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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO and textfile driver - how to force all field types as text??

Status
Not open for further replies.

DamoOz

Programmer
Oct 18, 2000
24
AU
I have the follow code extract where I access the contects of a text file through ADO and run a SQL query to populate a table with the text file contents. This work fine apart from some fields which the text driver is assuming is a long integer and I need to access the field as a text data type. Is there any way of forcing the text driver to assume all fields are text and not allow it to guess the data type



here is the code extract

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & gsProgRoot & "aus_gsp_cdr.mdb"

sSQL = "INSERT INTO myTable & _ (REC_CODE,TYPE_CALL,......OUTP_NUM )" & _
"SELECT f1, f2, f3, f4,......f36, f37 FROM " & _
"[Text;Database=" & gsEDMPath_Syd & ";HDR=NO;FMT=Delimited].[myfile.txt]"

cn.Execute sSQL
 

This has already been asked in thread709-334828. Please continue your questioning there. *******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top