AndyCabbages
Registered User.
- Local time
- Today, 05:18
- Joined
- Feb 15, 2010
- Messages
- 74
I am getting the following error:
Run-time error '3134'
Syntax error in INSERT INTO statement
This is the piece of code I am directed to:
Private Function addSuite()
If suiteName = "" Or Description = "" Then
MsgBox "Please enter a name and description for this suite!"
Else
If equip1 = "" Or equip2 = "" Then
MsgBox "Please make sure that the first two items are selected!"
Else
If DayPrice = "" Or WeekPrice = "" Then
MsgBox "Make sure you have entered a day price and a week price for this suite!"
Else
addSQL = "INSERT INTO suites (Name, Description, Day_Price, Week_Price, Item1, Item2, Item3, Item4, Item5, Item6, Insurance_Value, Weight) Values ('" & suiteName & "', '" & Description & "', " & DayPrice & ", " & WeekPrice & ", '" & equip1 & "', '" & equip2 & "', '" & equip3 & "', '" & equip4 & "', '" & equip5 & "', '" & equip6 & "', '" & IValue & "', '" & GrossWeight & "')"
DoCmd.RunSQL (addSQL)
DoCmd.Close
End If
End If
End If
End Function
The debugger suggests that the error is on the line:
DoCmd.RunSQL (addSQL)
Any suggestions? I really dont know much about visual basic and cant make such sense of the above piece of code.
Andy
Run-time error '3134'
Syntax error in INSERT INTO statement
This is the piece of code I am directed to:
Private Function addSuite()
If suiteName = "" Or Description = "" Then
MsgBox "Please enter a name and description for this suite!"
Else
If equip1 = "" Or equip2 = "" Then
MsgBox "Please make sure that the first two items are selected!"
Else
If DayPrice = "" Or WeekPrice = "" Then
MsgBox "Make sure you have entered a day price and a week price for this suite!"
Else
addSQL = "INSERT INTO suites (Name, Description, Day_Price, Week_Price, Item1, Item2, Item3, Item4, Item5, Item6, Insurance_Value, Weight) Values ('" & suiteName & "', '" & Description & "', " & DayPrice & ", " & WeekPrice & ", '" & equip1 & "', '" & equip2 & "', '" & equip3 & "', '" & equip4 & "', '" & equip5 & "', '" & equip6 & "', '" & IValue & "', '" & GrossWeight & "')"
DoCmd.RunSQL (addSQL)
DoCmd.Close
End If
End If
End If
End Function
The debugger suggests that the error is on the line:
DoCmd.RunSQL (addSQL)
Any suggestions? I really dont know much about visual basic and cant make such sense of the above piece of code.
Andy