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!

Problems with rounding up currency

Status
Not open for further replies.

dafyddg

Programmer
Dec 2, 2003
92
GB
Hi,

I've written an SQL query thats designed to increase all the values in a field by a specified percentage. This is the SET part of the query

SET Rates.[Unit Cost] = Rates.[Unit Cost] * " & actualrate

Unit Cost field is set to Curreny with 2 decimal places and actual rate is a number such as 1.01 for 1% increase.

The problem i'm having is that the figures aren't being rounded up to two decimal places. They are stored with 4 even though at first they only display 3. Is there something i can do about this or will i need to write code to deal with this situation.
 
Hi,

The round function should do it:

SET Round(Rates.[Unit Cost],2) = Rates.[Unit Cost] * " & actualrate



HTH,
Bob [morning]
 
Make sure the Format Property for the field in your query is set to Currency. If you right click on the field and open Properties, you will see the format property. Set it to Currency. If for some reason that doesn't work, you can try wrapping your expression in the
CCur(Rates.[Unit Cost] * " & actualrate
) expression.

Paul
 
Thanks for the replies guys, Bob, that Round function worked a treat. Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top