The DecimalPlaces property to limit the maximum number of decimals
displayed, it won't give you trailing zeros. If that is what you need, then
you'll need to adjust the Format property of the textbox also.
Select Case txtRes
Case 0.1
Me.txtResult.DecimalPlaces = 1
Me.txtResult.Format = "0.0"
Case 0.01
Me.txtResult.DecimalPlaces = 2
Me.txtResult.Format = "0.00"
Case Else
Me.txtResult.DecimalPlaces = 0
End Select
If you want commas in for separators also, you'll need to expand the format.
Me.txtREsult.Format = "#,##0.00"
--
Wayne Morgan
MS Access MVP
"John Milward" <(E-Mail Removed)> wrote in message
news:dveceu$t0s$(E-Mail Removed)...
> Hi
>
> I have created a report which prints tables of numbers.
> I need to change the number of decimal places shown for each table
> I have an additional field (txtRes) that specifies the number of decimal
> places
>
> I have tried the following code in Detail_Format & Detail_Print
>
> Select Case txtRes
> Case 0.1
> Me.txtResult.DecimalPlaces = 1
> Case 0.01
> Me.txtResult.DecimalPlaces = 2
> Case Else
> Me.txtResult.DecimalPlaces = 0
> End Select
>
> The case statement is responding to txtres, but the statement
> Me.txtResult.DecimalPlaces = ? does nothing
>
> The design properties for txtResult are set to fixed Format and Decimal
> places = 0
>
> Any help would be appreciated
>
> TIA
>
> John
>
>
|