update query

  • Thread starter Thread starter peljo via AccessMonster.com
  • Start date Start date
P

peljo via AccessMonster.com

How can i build a query where all the rows having -. for example -1, or -2
etc, to be set to o ?
 
How can i build a query where all the rows having -. for example -1, or -2
etc, to be set to o ?

Create a Query based on your table.

On the Criteria line under the relevant field, put your criterion - for
instance just -1 or

IN (-1, -2)

if you want all records with either of these values changed. Open the query as
a datasheet just to be sure it's selecting the records you want!

Change the query to an Update query.

Put 0 on the Update To line.

Run the query.
 
Thank you very much for your reply. I need a query that automatically updates
all the entries being < 0 and updating them to 0. is it possible ?
 
Thank you very much for your reply. I need a query that automatically updates
all the entries being < 0 and updating them to 0. is it possible ?
 
UPDATE YourTable
SET YourField = 0
WHERE YourField <0

In query design view
-- Open a new query
-- Select your table
-- Add the field you want to change to the grid
-- Set the criteria under the field to < 0
-- Select Query: Update from the menu
-- Type 0 into the Update To "cell"

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Thank you very much for your reply. I need a query that automatically updates
all the entries being < 0 and updating them to 0. is it possible ?

peljo,

Instead of "IN (-1,-2)" use "<0"

That should do the trick!

Chris M.
 
Back
Top