When you get a syntax error in what looks like a good SQL statement it is usually because one of your column names is a reserved word. There are several likely candidates in there including Trigger, Size and Type. These are just the sort of words that are likely to have special meaning in a programming language, especially Trigger in SQL. Try putting square brackets around the suspicious column names.
Also, you're writing considerably more code than is necessary. This:can be reduced to this:VB Code:
invCmd.Parameters.Add("@desc2", OleDb.OleDbType.Char) invCmd.Parameters("@desc2").Value = "d2" & Me.uiDescriptionTextBox.Textbecause Add returns a reference to the parameter just added. Having said that, there's no need to specify the parameter type because it will implicitly take on the appropriate type for the value you specify. As you're specifying a string for each Value and each parameter is a text type there's no need to specify a type. Your code then reduces further to this:VB Code:
invCmd.Parameters.Add("@desc2", OleDb.OleDbType.Char).Value = "d2" & Me.uiDescriptionTextBox.TextVB Code:
invCmd.Parameters.Add("@desc2", "d2" & Me.uiDescriptionTextBox.Text)




Reply With Quote