Artemis Hothmire
Registered User.
- Local time
- Today, 12:19
- Joined
- Nov 19, 2012
- Messages
- 23
Good afternoon,
I am running into some problems. I am writing the below code for one of my forms:
Private Sub cmdCatalogDeficitValues_Click()
MsgBox "Appending deficit values to history table"
Dim strquery As String
strquery = "INSERT INTO [tblAnnualMidYearBudgetReviewHistory] " & _
"([OddCogTotDefVal], [EvenCogTotDefVal], [GPETETotalDefVal], [IntOddTotDefVal], [IntEvenTotalDefVal], [RepOddTotDefVal], [RepEvenTotDefVal])" & _
"VALUES(" & _
"" & Me.txtOddCogTotalDefVal.Value & "," & _
"" & Me.txtEvenCodTotaDefVal.Value & "," & _
"" & Me.txtRepairCogTotalDefVal.Value & "," & _
"" & Me.txtInitialOddCogDefVal.Value & "," & _
"" & Me.txtInitialIssueEvenCogDef.Value & "," & _
"" & Me.txtReplacementIssueOddCogDef.Value & "," & _
"" & Me.txtReplacementIssueEvenCogDef.Value & "," & _
")"
DoCmd.RunSQL strquery
MsgBox "Deficit values have been added"
End Sub
The problem is I keep getting an error, error number 3134 (Syntax Error) on the docmd.runsql portion. I have double checked everything and there are no mispellings, so thats not it. And the punctuation is the same as another VBA code on another form, only the fields and tables have changed. I cant figure out whats wrong. Please help.
I am running into some problems. I am writing the below code for one of my forms:
Private Sub cmdCatalogDeficitValues_Click()
MsgBox "Appending deficit values to history table"
Dim strquery As String
strquery = "INSERT INTO [tblAnnualMidYearBudgetReviewHistory] " & _
"([OddCogTotDefVal], [EvenCogTotDefVal], [GPETETotalDefVal], [IntOddTotDefVal], [IntEvenTotalDefVal], [RepOddTotDefVal], [RepEvenTotDefVal])" & _
"VALUES(" & _
"" & Me.txtOddCogTotalDefVal.Value & "," & _
"" & Me.txtEvenCodTotaDefVal.Value & "," & _
"" & Me.txtRepairCogTotalDefVal.Value & "," & _
"" & Me.txtInitialOddCogDefVal.Value & "," & _
"" & Me.txtInitialIssueEvenCogDef.Value & "," & _
"" & Me.txtReplacementIssueOddCogDef.Value & "," & _
"" & Me.txtReplacementIssueEvenCogDef.Value & "," & _
")"
DoCmd.RunSQL strquery
MsgBox "Deficit values have been added"
End Sub
The problem is I keep getting an error, error number 3134 (Syntax Error) on the docmd.runsql portion. I have double checked everything and there are no mispellings, so thats not it. And the punctuation is the same as another VBA code on another form, only the fields and tables have changed. I cant figure out whats wrong. Please help.