BrandonM30
New member
- Local time
- Today, 12:53
- Joined
- Sep 16, 2016
- Messages
- 9
Good afternoon all,
I am having a problem with my insert into statements. I have different types of form controls, combo boxes, text fields, and date fields pulling different kinds of data, names, numbers, dates, etc. and putting them my table, I keep getting syntax errors, and I have no idea why.
Please help, and thank you.
Public Sub cmdAppendToRecLog_Click()
MsgBox "Appending Transaction to Receiving Log"
Dim strquery As String
strquery = "INSERT INTO [RLTest] " & _
"([Date1], [Text1], [Text2], [Number1], [Number2], [Number3], [Text3], [Number4], [Number5], [Text4], [Number6], [Text5], [Number7], [Number8], [Text6], [Date2], [Text7], [Number9], [Text8], [Text9])" & _
"VALUES(" & _
"#" & Me.txtDate1.Value & "#" & _
"" & Me.cmbText1.Value & "," & _
"" & Me.cmbText2.Value & "," & _
"" & Me.txtNumber1.Value & "," & _
"" & Me.cmbNumber2.Value & "," & _
"" & Me.cmbNumber3.Value & "," & _
"" & Me.txtText3.Value & "," & _
"" & Me.cmbNumber4.Value & "," & _
"" & Me.cmbNumber5.Value & "," & _
"" & Me.cmbText4.Value & "," & _
"" & Me.cmbNumber6.Value & "," & _
"" & Me.cmbText5.Value & "," & _
"" & Me.txtNumber7.Value & "," & _
"" & Me.txtNumber8.Value & "," & _
"" & Me.cmbText6.Value & "," & _
"#" & Me.txtDate2.Value & "#" & _
"" & Me.cmbText7Value & "#" & _
"" & Me.txtNumber9.Value & "," & _
"" & Me.cmbText8.Value & "," & _
"" & Me.txtText9.Value & "," & _
")"
DoCmd.RunSQL strquery
MsgBox "Transaction has been appended to the Receiving Log"
I am having a problem with my insert into statements. I have different types of form controls, combo boxes, text fields, and date fields pulling different kinds of data, names, numbers, dates, etc. and putting them my table, I keep getting syntax errors, and I have no idea why.
Please help, and thank you.
Public Sub cmdAppendToRecLog_Click()
MsgBox "Appending Transaction to Receiving Log"
Dim strquery As String
strquery = "INSERT INTO [RLTest] " & _
"([Date1], [Text1], [Text2], [Number1], [Number2], [Number3], [Text3], [Number4], [Number5], [Text4], [Number6], [Text5], [Number7], [Number8], [Text6], [Date2], [Text7], [Number9], [Text8], [Text9])" & _
"VALUES(" & _
"#" & Me.txtDate1.Value & "#" & _
"" & Me.cmbText1.Value & "," & _
"" & Me.cmbText2.Value & "," & _
"" & Me.txtNumber1.Value & "," & _
"" & Me.cmbNumber2.Value & "," & _
"" & Me.cmbNumber3.Value & "," & _
"" & Me.txtText3.Value & "," & _
"" & Me.cmbNumber4.Value & "," & _
"" & Me.cmbNumber5.Value & "," & _
"" & Me.cmbText4.Value & "," & _
"" & Me.cmbNumber6.Value & "," & _
"" & Me.cmbText5.Value & "," & _
"" & Me.txtNumber7.Value & "," & _
"" & Me.txtNumber8.Value & "," & _
"" & Me.cmbText6.Value & "," & _
"#" & Me.txtDate2.Value & "#" & _
"" & Me.cmbText7Value & "#" & _
"" & Me.txtNumber9.Value & "," & _
"" & Me.cmbText8.Value & "," & _
"" & Me.txtText9.Value & "," & _
")"
DoCmd.RunSQL strquery
MsgBox "Transaction has been appended to the Receiving Log"