'ADODB INSERT INTO command adding ' at the start of each field after adding record
I am trying to add a record into a closed excel book from an open excel book using ADODB and SQL INSERT INTO Statement. I am on O365 version. Whenever record is added to file it adds ' at start of each field.
eg. 3/3/2022 is added as '3/3/2022, no 234 added as '234...
Pls help
Below is the sql text:
MYSTRING = "'" & Range("$A$2").Text & "'" & "," & "'" & Range("$B$2").Text & "'" & "," & "'" & Range("$C$2").Text & "'" & "," & CInt(Range("$D$2").Value) & "," & "'"
SQLCommand = "INSERT INTO \[Dump2$\] " & "VALUES (" & MYSTRING & ")"
I tried using ', # around field, changing data type in destination excel file. If I assign specific data type to columns in destination file I get the error
Data type mismatch in criteria expression
Pls suggest
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
