29. juni 2010 - 15:45
Der er
3 kommentarer og 1 løsning
Insert Into
På denne runsql kommando får jeg fejlen runtime error 3134 Syntax error in sql statement: DoCmd.RunSQL "INSERT INTO dbo_EventHistory (id, created, createdBy, updated, updatedBy, ownedBy, objType, objId, eventHistoryType," & _ "sEStatusId, customerId, instrumentId, custInstrId, caseNo, custInstrNo, arepaNo, descr, intNote, extNote, eventTime, docType," & _ "docNo, docId, custReq, initials, signed, activityNo) VALUES ( " _ & newid & ",#" & DateValue(Now()) & "#," & RcsOrg.Fields(2) & ",#" & DateValue(Now()) & "#," & RcsOrg.Fields(4) & "," & RcsOrg.Fields(5) _ & "," & RcsOrg.Fields(6) & "," & RcsOrg.Fields(7) & "," & RcsOrg.Fields(8) & "," & RcsOrg.Fields(9) & "," & RcsOrg.Fields(10) _ & "," & RcsOrg.Fields(11) & "," & RcsOrg.Fields(12) & "," & RcsOrg.Fields(13) & "," & RcsOrg.Fields(14) & "," & RcsOrg.Fields(15) _ & "," & RcsOrg.Fields(16) & ", Null, Null," & RcsOrg.Fields(19) & "," & RcsOrg.Fields(20) & "," & RcsOrg.Fields(21) _ & ", Null ," & RcsOrg.Fields(23) & ", Null , Null, Null)"
Annonceindlæg fra Infor
Try putting th eSQL into a variable and then copying the contents of the variable into a query DIM sSQL as string sSQL = ""INSERT INTO dbo_EventHistory (id, created, createdBy, updated, updatedBy, ownedBy, objType, objId, eventHistoryType," & _ "sEStatusId, customerId, instrumentId, custInstrId, caseNo, custInstrNo, arepaNo, descr, intNote, extNote, eventTime, docType," & _ "docNo, docId, custReq, initials, signed, activityNo) VALUES ( " _ & newid & ",#" & DateValue(Now()) & "#," & RcsOrg.Fields(2) & ",#" & DateValue(Now()) & "#," & RcsOrg.Fields(4) & "," & RcsOrg.Fields(5) _ & "," & RcsOrg.Fields(6) & "," & RcsOrg.Fields(7) & "," & RcsOrg.Fields(8) & "," & RcsOrg.Fields(9) & "," & RcsOrg.Fields(10) _ & "," & RcsOrg.Fields(11) & "," & RcsOrg.Fields(12) & "," & RcsOrg.Fields(13) & "," & RcsOrg.Fields(14) & "," & RcsOrg.Fields(15) _ & "," & RcsOrg.Fields(16) & ", Null, Null," & RcsOrg.Fields(19) & "," & RcsOrg.Fields(20) & "," & RcsOrg.Fields(21) _ & ", Null ," & RcsOrg.Fields(23) & ", Null , Null, Null)" Then place a breakpoint AFTER this line of code. Run to breakpoint and then in the debug window (CTRL+G) Then write, followed by return. ?sSQL You now see teh SQL which your sending to DoCmd.RunSQL copy this to a query where its MUCH easier to see the problem