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

change value in query if lower than expected 3

Status
Not open for further replies.

Ammodog

Technical User
Dec 13, 2002
97
US
How do I change the value in a query if lets say I wanted at least a min of a $5.00 value and I have a value of $2.50. How can I change the $2.50 value to $5.00? Thanks

Christopher Abney
There is no limit to the good you can do if you dont care who gets the credit
 
What do you mean: Change the Value in a Query???

Do you mean you want to find all the instances of $2.50 in a TABLE and update the value to $5.00?

UPDATE TableName Set FieldName = '$5.00' WHERE FieldName = '$2.50'



Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
Or something like:
[tt][red]
UPDATE TableName
SET FieldName = 5
WHERE FieldName < 5;[/red][/tt]

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Actually I do not store that value in a tabe, I get it from a caculation in the query. when I get the result if it is below $5 I want the value to be set to $5 in the query.

Christopher Abney
There is no limit to the good you can do if you dont care who gets the credit
 
i think you are looking for a CASE statement...something like this...

SELECT CASE WHEN blah< 5 then '5' else 'blah' end as myfield...

i am not completely sure of the equivalent syntax in access...

-DNG
 
Try this in Access queries:
SELECT IIf(blah<5, 5, blah) as myfield ...



Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top