Formatting a field in Detail Section

accessNator

Registered User.
Local time
Today, 15:31
Joined
Oct 17, 2008
Messages
132
I have a control text box which outputs a currency amount from a query as its source. I have formatted the amount to be a currency value and display it with two decimal places. But in reality sometimes that amount is actually 4 decimal places. When I do a group total, it messes up the actual total due to the decimal places. How can I format the control to use a custom ROUND function that I created? Is it possible to use the ONFORMAT event to actually change the value to 2 decimal places, if so can you provide me an example?

I have tried:
me.amount = Round(me.amount,2)

But it gives me an run time error message, stating that I cant assign a value.

Thanks in advance.
 
I don't really understand the problem.

However you should be able to perform the total calculations at full precision on the field in the record source query.

The format of the control only affects what is displayed not the actual value.

You can't assign a value to a bound control but you can change its properties.
Me.controlname.DecimalPlaces = 2
 
I don't really understand the problem.

However you should be able to perform the total calculations at full precision on the field in the record source query.

The format of the control only affects what is displayed not the actual value.

You can't assign a value to a bound control but you can change its properties.
Me.controlname.DecimalPlaces = 2

Thank you for your reply. My total calculation from my record source query does carry out to 4 decimal places and it throws off my total value because its too precise. I will try to explain my situation in the QUERY section of this forum . Your reply does help me in future situations though.
 
Now I see.

The rounded figure needs to be calculated in a derived field in a query. Then bind that field to the textbox.

In the field box of the designer:
RoundAmount: Round(etc....)

Then your totals can calculate on the rounded figure.
 

Users who are viewing this thread

Back
Top Bottom