"onedaywhen" wrote in message
om...
Dick, With Excel as the data source, you must use MS Jet syntax. The
INT function works for me e.g.
cmd.CommandText="INSERT INTO [Data$] (Col1,Col2) Values
(INT(3),INT(5))"
--
It does not for me, using
Sub InsInto()
Dim Conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim stConn As String
Dim stSQL As String
Dim LAIdx As Long, i As Long
'Set up connection string
stConn = "DSN=Excel Files;DBQ=c:\Dick\ADOTest.xls"
stConn = stConn & ";DefaultDir=c:\Dick;DriverId=22;"
stConn = stConn & "MaxBufferSize=2048;PageTimeout=5;"
'Set up sql to insert
stSQL = "Insert Into [Sheet2$] (US) values (INT(8))"
'Create new connection
Set Conn = New ADODB.Connection
'Open the connection
Conn.Open stConn
'Execute the sql
Conn.Execute (stSQL)
Conn.Close
End Sub
--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.