T
Todd Huttenstine
Hey guys
Ive been struggling with the below code for an hour. I
keep getting the error:
Syntax error in INSERT INTO Statement.
Dim objConn As ADODB.Connection
Dim szConnect As String
Dim szSQL As String
' Create the connection string.
szConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=E:\QTD\Sales.xls;" & _
"Extended Properties=Excel 8.0;"
' Create the SQL statement.
szSQL = "INSERT INTO Sheet1 " & _
"VALUES('Val1', 'Val2', 'Val3', 'Val4');"
' Create and open the Connection object.
Set objConn = New ADODB.Connection
objConn.Open szConnect
' Execute the insert statement.
objConn.Execute szSQL, , adCmdText Or
adExecuteNoRecords
' Close and destroy the Connection object.
Can anyone please help me?
Thank you
Todd Huttenstine
objConn.Close
Set objConn = Nothing
Ive been struggling with the below code for an hour. I
keep getting the error:
Syntax error in INSERT INTO Statement.
Dim objConn As ADODB.Connection
Dim szConnect As String
Dim szSQL As String
' Create the connection string.
szConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=E:\QTD\Sales.xls;" & _
"Extended Properties=Excel 8.0;"
' Create the SQL statement.
szSQL = "INSERT INTO Sheet1 " & _
"VALUES('Val1', 'Val2', 'Val3', 'Val4');"
' Create and open the Connection object.
Set objConn = New ADODB.Connection
objConn.Open szConnect
' Execute the insert statement.
objConn.Execute szSQL, , adCmdText Or
adExecuteNoRecords
' Close and destroy the Connection object.
Can anyone please help me?
Thank you
Todd Huttenstine
objConn.Close
Set objConn = Nothing