Adding or Substracting from a current value in table

  • Thread starter Thread starter kikeman
  • Start date Start date
K

kikeman

Hi,

I have a table with a column "Hrs" that is a double type.

I would like to add or substract hours to the current value with a single
UPDATE command. i.e:

Orders Hrs
Q6E4D3 2.5

I would need to add 3.5 hrs:

Orders Hrs
Q6E4D3 6.0

What would be the SQL UPDATE command to do this?

Thanks,
kikeman.
 
Open up a new query in design view based on the table in question.

Add both the Orders and Hrs fields to the grid.

In the criteria for Order put: Q6E4D3

Run the query to ensure it selects the expected records.

If so, go back to design view and change the query from Select to Update.
(Knowing the version of Access would have been nice here)

In the Update To line under the Hrs field put the following:

[Hrs] + 3.5

Run the query and you should get a warning of how many records will be
updated.

As it seems that you are new at this, you may want to make a complete backup
of the database file or at least the table in question first.
 
Why post twice? This question was already addressed in an earlier
post/response.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
Back
Top