troubleshooting Question

Problem with doing a calculation in an ASP Update statement

Avatar of Mark Lewis
Mark Lewis asked on
Microsoft AccessASP
3 Comments1 Solution101 ViewsLast Modified:
My predecessor programmed our Intranet using ASP ages ago. There's code on a form submittal where it's using an Update statement to take away from the number showing in the database:

myConnString = Application("Flash_ConnectionString")	
Set myConnection = Server.CreateObject("ADODB.Connection")
myConnection.Open myConnString
	
mySql="UPDATE OnHand SET ohnum = ohnum - 1 WHERE ohnum > 0"
  
myConnection.Execute mySQL
myConnection.Close
Set myConnection = Nothing

This works fine but we have since changed things to where the form allows the person to put any number for this item that we still need to subtract from the DB.

To make things easier, I call the value from the form and assign it to the variable s16: s16 = Request.Form("size16")

Then I try to get the Update statement to use my s16 var rather than the static number (mySql="UPDATE OnHand SET ohnum = ohnum - s16 WHERE ohnum > 0") and the web page returns this error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/flash/Confirm.asp, line 233

Some things I do know:
1. Both ohnum and size16 are a Number data type in the Access DB
2. Via a Response.Write Command, I verified that the variable s16 does carry the correct information.

It's probably some kind of text/number mismatch but I cant seem to figure it out.

I have zero training with ASP so be gentle :)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros