NickHallick
NickHallick

Reputation: 239

vb6 error "Too few parameters, Expected 1."

Its obviously an error in an sql statement, I just don't know why. I have used this statement on other parts of the same module however when I run it in this instance it comes up with this error.

The code is this:

strQuery = "SELECT [Tablename] FROM Licence_Product WHERE [Product_Code] = '" & rsOrder.Fields(2) & "'"
Set rsProduct = dbLicence.CreateDynaset(strQuery)

I'm not sure how much of the code to include so any additional code can be provided. Like I said I have used this exact line elsewhere and it works fine.

Upvotes: 0

Views: 2267

Answers (1)

Linger
Linger

Reputation: 15048

It sounds like the Product_Code is not a string. Try the following:

strQuery = "SELECT [Tablename] FROM Licence_Product WHERE [Product_Code] = " & rsOrder.Fields(2)

Upvotes: 1

Related Questions