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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you update a number to negative in a query?

Status
Not open for further replies.

akascorpious

Technical User
Joined
Apr 22, 2004
Messages
3
Location
US
Running Access 2002, doing an update query and need to update a particular field in a table to a negative amount based on another criteria. Seemed easy enough but i can't seem to do it with the query builder:
"-[Detail]![Amount]"
 
Just multiply the number by -1, eg

[Detail]![Amount]*-1

John
 
Thanks John! That did the trick to convert to negative numbers, but its converting all of records in this table. I have the update query on 2 tables, and i need to limit the numbers that should be negative based on a criteria from one of those tables. So my amount field in my detail table should be negative where the "indicator" field in the Import table is a "Y"?
field: amount
Table: detail
update to: [Detail]![Amount]*-1
criteria: ? where [import]]![ind] = "Y" is this the right spot or right way to specifiy the criteria?
 
add the field that needs to be yes to the query, in the criteria of that field add "Y".

HTH

leslie
 
As lespaul says, just specify appropriate criteria for the query.

John
 
Thanks Leslie, I had tried that before but it still wasn't working. After looking at the table again, i had jargon in that field so that would explain why it would update "0" records. I guess i updated that field before in getting this to work and didn't clean it out.

My query is working now, thank you everybody!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top