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!

Addition in an update query

Status
Not open for further replies.

aggiematt

IS-IT--Management
Jun 29, 2004
2
US
I am trying to make a form that adds and subtracts from a table using an update query.
My current query is
UPDATE (TABLENAME) SET TABLENAME.Quantity = TABLENAME.Quantity + !FORMS!FORMNAME!CONTROLNAME
WHERE TABLENAME.FIELDNAME = FORMS!FORMNAME!CONTROLFIELDNAME
Sometimes it adds sometimes it doesnt sometime it just replace the value in the table with the quantity input.
When suctraction is used in the same query nothing happens.
 
Hi

maybe its just a tupo in the post, but:

UPDATE (TABLENAME) SET TABLENAME.Quantity = TABLENAME.Quantity + !FORMS!FORMNAME!CONTROLNAME
WHERE TABLENAME.FIELDNAME = FORMS!FORMNAME!CONTROLFIELDNAME

you have a surplus !, should be:

UPDATE (TABLENAME) SET TABLENAME.Quantity = TABLENAME.Quantity + FORMS!FORMNAME!CONTROLNAME
WHERE TABLENAME.FIELDNAME = FORMS!FORMNAME!CONTROLFIELDNAME


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top