2 decimals with currency

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

In code I have a function that calculates a value.

round( (Value1 + Value2)/value3;2)

This works fine.
Only if the total is for example 70,70. it rounds 70,7

since it is a currency I want the functions always to round 2 decimals.

How do I create this function?

Abrm
 
The function, I would presume, is run in order to display the value. What
kind of formatting do you have on the means by which you are displaying the
function's output? That is, you may need to apply formatting to your form
or your query or your report in order to "see" your correctly formatted
value.
 
sorry,
It didn't tell alll
The variable is a currency and the ouput is a text string in a report.
The complete function looks like this

dim Value as currency

value = round( (Value1 + Value2)/value3;2)

me.textbox = ('the amount is [value]")

Is there a way to give the variable "value" always two decimals, like a
textbox?
 
sorry,
It didn't tell alll
The variable is a currency and the ouput is a text string in a report.
The complete function looks like this

dim Value as currency

value = round( (Value1 + Value2)/value3;2)

me.textbox = ('the amount is [value]")

Is there a way to give the variable "value" always two decimals, like a
textbox?
FormatNumber is your friend

If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
showSorry, doesn't work.
The result is 70,7.

The pnly thing I want is if the result is 70,70 or 70,80 or etc.

That the reulst of the function shows 70,70 and doesn't round it to 70,7.
That is ok if we talk about a number but that's not ok for a currency.

Who can help?

Andi Mayer said:
sorry,
It didn't tell alll
The variable is a currency and the ouput is a text string in a report.
The complete function looks like this

dim Value as currency

value = round( (Value1 + Value2)/value3;2)

me.textbox = ('the amount is [value]")

Is there a way to give the variable "value" always two decimals, like a
textbox?
FormatNumber is your friend

If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
Immediate window:
?Formatnumber(70.7,2)
70.70
?Formatnumber(70.7,5)
70.70000

And what is not working?
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
to make it even clearer for you:
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
Thanks,
it works.

What did I do wrong!!!
I did this the first time that it didn't work.
dim Value as currency
value = round( (Value1 + Value2)/value3;2)

value= formatnumber(value, 2)

me.textbox = ('the amount is [value]")

But with your syntax it is running.

many thanks.

b.
 
Thanks,
it works.

What did I do wrong!!!
I did this the first time that it didn't work.
dim Value as currency
value = round( (Value1 + Value2)/value3;2)

value= formatnumber(value, 2)

this is a curreny-Variable, therefore it doesn't make sense to store
a trailing zero

formatnumber-result is a string, if you store a string into a curreny
it get's converted to currency (if posible)


If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
Back
Top