[RESOLVED] INSERT statement is not working...
I am getting an error with this code. It says there is a syntax error near "," which is pretty useless. I am almost positive is has to do with the NULL statements.
VB Code:
Dim sqlinsert As String
sqlinsert = "INSERT INTO PENDINGART ([CUST], [PRTD], [CUSTART], [DESC], [DATEREC], [SIZE], [DATERQD], [STATUS], [SAMPLENEEDED], [NOTES]) VALUES("
sqlinsert = sqlinsert & "'" & XCUST & "', "
sqlinsert = sqlinsert & "'" & Xprtd & "', "
sqlinsert = sqlinsert & "'" & Xcustart & "', "
sqlinsert = sqlinsert & "'" & xDESC & "', "
If IsDate(XDATEREC) Then
sqlinsert = sqlinsert & "'" & XDATEREC1 & "', "
Else
sqlinsert = sqlinsert & Null & ", "
End If
sqlinsert = sqlinsert & "'" & xSIZE & "', "
If IsDate(Xdaterqd) Then
sqlinsert = sqlinsert & "'" & XDATERQD1 & "', "
Else
sqlinsert = sqlinsert & Null & ", "
End If
sqlinsert = sqlinsert & "'" & xstatus & "', "
sqlinsert = sqlinsert & "'" & XSAMPLENEEDED & "', "
sqlinsert = sqlinsert & "'" & xnotes & "') "
CnxnTechSQL.Execute sqlinsert
Re: INSERT statement is not working...
Re: INSERT statement is not working...
You need to put the text "Null" into the string, rather than the value, eg:
sqlinsert = sqlinsert & "Null" & ", "
Re: INSERT statement is not working...
That did it, thanks. I thought that NUL would eb treating as a literal, but it worked.