greaseman
Closer to seniority!
- Local time
- Today, 09:00
- Joined
- Jan 6, 2003
- Messages
- 360
I've got a piece of code that contains a few queries. My problem is that some of the queries work, while others give me a "Syntax error in INSERT INTO statement" message. I'm going crazy trying to figure out why some queries work, but others don't.
If someone could take a look and offer a thought or two, or three..... I would appreciate t before I go postal. And, thanks so much in advance!! Can't believe how much this forum offers....it's great!
Here's my piece of code:
THIS QUERY WORKS
strSQL = ""
strSQL = strSQL & "INSERT INTO MasterPN "
strSQL = strSQL & "(PN, FSCM, Keyword, Description, SPN, ATAPN, DimData, ESDS) "
strSQL = strSQL & "VALUES ('" & strElement & "', '" & strFSCM & "', "
strSQL = strSQL & " '" & strKey & "', '" & strDesc & "', "
strSQL = strSQL & " '" & strCPN & "', '" & strATAPN & "', "
strSQL = strSQL & " '" & strdd & "', " & intESDS & ") "
conJetMasterDb.Execute strSQL, , adExecuteNoRecords
THIS QUERY WORKS, WITH THE USE OF BRACKETS.
strSQL = ""
strSQL = strSQL & "INSERT INTO Chapter "
strSQL = strSQL & "([Chapter], [Key]) "
strSQL = strSQL & "VALUES ('" & strChapter & "', '" & strChapterKey & "')"
conJetDestDb.Execute strSQL, , adExecuteNoRecords
THIS QUERY DOES NOT WORK, EVEN WITH USING BRACKETS ???????????
strSQL = ""
strSQL = strSQL & "INSERT INTO Section "
strSQL = strSQL & "([Chapter], [Section], [Key]) "
strSQL = strSQL & "VALUES ('" & strChapter & "', '" & strSection & "', '" & strSectionKey & "')"
Debug.Print strSQL
conJetDestDb.Execute strSQL, , adExecuteNoRecords
If someone could take a look and offer a thought or two, or three..... I would appreciate t before I go postal. And, thanks so much in advance!! Can't believe how much this forum offers....it's great!
Here's my piece of code:
THIS QUERY WORKS
strSQL = ""
strSQL = strSQL & "INSERT INTO MasterPN "
strSQL = strSQL & "(PN, FSCM, Keyword, Description, SPN, ATAPN, DimData, ESDS) "
strSQL = strSQL & "VALUES ('" & strElement & "', '" & strFSCM & "', "
strSQL = strSQL & " '" & strKey & "', '" & strDesc & "', "
strSQL = strSQL & " '" & strCPN & "', '" & strATAPN & "', "
strSQL = strSQL & " '" & strdd & "', " & intESDS & ") "
conJetMasterDb.Execute strSQL, , adExecuteNoRecords
THIS QUERY WORKS, WITH THE USE OF BRACKETS.
strSQL = ""
strSQL = strSQL & "INSERT INTO Chapter "
strSQL = strSQL & "([Chapter], [Key]) "
strSQL = strSQL & "VALUES ('" & strChapter & "', '" & strChapterKey & "')"
conJetDestDb.Execute strSQL, , adExecuteNoRecords
THIS QUERY DOES NOT WORK, EVEN WITH USING BRACKETS ???????????
strSQL = ""
strSQL = strSQL & "INSERT INTO Section "
strSQL = strSQL & "([Chapter], [Section], [Key]) "
strSQL = strSQL & "VALUES ('" & strChapter & "', '" & strSection & "', '" & strSectionKey & "')"
Debug.Print strSQL
conJetDestDb.Execute strSQL, , adExecuteNoRecords