Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE error - too few params

Status
Not open for further replies.

GerardMcL

Technical User
Aug 5, 2004
212
IE
Hi everybody!

strSQL = "UPDATE Tools SET Description = '" & tool_desc & "', Price = '" & tool_price & "', Bought = '" & tool_bought & "', Company = '" & comp_name & "' WHERE ToolID = '" & tool_id & "';"

cnSQL.Execute strSQL

I try to execute this and always get the same error
"To few parameters expected 2"
Im trying to UPDATE an Access 2000 database using VB6.
Why is this happening as far as I can see the code is fine.

Thanks!
 
If tool ID is NUMERIC then remove the single quotes.

If you put a break point on the execute line and print the sql statement in the immediate window do you see anything wrong?

Try coping it from the immediate window back to access, does it run?

I tried to have patience but it took to long! :) -DW
 
Also, if any of your:

tool_desc, tool_price, tool_bought, comp_name, tool_id

have any single quotes, your SQL will be wrong.

First check tool_desc and comp_name


Have fun.

---- Andy
 
Normally, you would then get a type conversion error on "ToolID", if this is of Type Long. The other field values should still convert, depending on the Local used.
However, maybe you have all fields defined as Text?

I would also inspect the fields names closely to see if they match the actual database field names.

"To few parameters" means that because the (field)names given cannot be identified as actual field names in the DB Table, and therefore they must be parameters, which haven't been yet defined and assigned a value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top