I am rusty on Insert Into VBA code syntax to append records into a SQL Server DB TABLE from MS Access VBA code with a linked to SQL Server table for doing the inserts.
I only get a little time on the Server Cloud desktop later in the week to test this... so I am trying to pre CHECK my code for accuracy before my limited time for testing
IS MY VBA INSERT CODE CORRECT, SOMEWHAT CORRECT, IN ERROR ???
I have VARiables in my insert into VBA code
mnDate = Forms!frFlies!MyDateVar '(ie: "0622') 'A string Variable
'iRps is an int Variable
'OFFDUTY_ and mnDate (both string variable) trying to concatenate that with the word OFFDUTY_ in my syntax.
'dblSumOffDuty is a int decimal variable
Debug does not give an error. Worried about runtime error or SQL insert error.
strInsert = "INSERT INTO dbo_[A4Survey_Client_1].[Survey_1_1207].[Response] RpsRespondent,RpsVariableId,RpsQuestion,RpsMatrix,RpsMention,RpsContent,RpsOpened,projectId,modifiedBy,modified,ImportedValue,Source)" & _
"VALUES (' & iRps & ',1,'OFFDUTY_' + ' & mnDate & ',1,1,' & dblSumOffDuty & ',NULL,1207,999999,GETUTCDATE(),NULL,1)"
db.Execute strInsert
strInsert = ""
I only get a little time on the Server Cloud desktop later in the week to test this... so I am trying to pre CHECK my code for accuracy before my limited time for testing
IS MY VBA INSERT CODE CORRECT, SOMEWHAT CORRECT, IN ERROR ???
I have VARiables in my insert into VBA code
mnDate = Forms!frFlies!MyDateVar '(ie: "0622') 'A string Variable
'iRps is an int Variable
'OFFDUTY_ and mnDate (both string variable) trying to concatenate that with the word OFFDUTY_ in my syntax.
'dblSumOffDuty is a int decimal variable
Debug does not give an error. Worried about runtime error or SQL insert error.
strInsert = "INSERT INTO dbo_[A4Survey_Client_1].[Survey_1_1207].[Response] RpsRespondent,RpsVariableId,RpsQuestion,RpsMatrix,RpsMention,RpsContent,RpsOpened,projectId,modifiedBy,modified,ImportedValue,Source)" & _
"VALUES (' & iRps & ',1,'OFFDUTY_' + ' & mnDate & ',1,1,' & dblSumOffDuty & ',NULL,1207,999999,GETUTCDATE(),NULL,1)"
db.Execute strInsert
strInsert = ""