Decimal Places

Hiten

Registered User.
Local time
Today, 14:50
Joined
Sep 17, 2001
Messages
51
is there a way to have a currency field, that is the user enters 3 decimal places it displays 3 d.p. but in the same field if the users enters a 2 d.p. number it only displays 2 d.p with out the 0 on the end

e.g

$999.123 ( 3.d.p.)
$999.12 (2.d.p) i dont want it to displa $999.120

does this makes sense
 
I suppose you could on the on_current event of the form try

If Val(Right(Me.NameOfCurrencyControl,1)) > 0 then
Me.NameOfCurrencyControl.DecimalPlaces = 3
Else Me.NameOfCurrencyControl.DecimalPlaces = 2
Me.Refresh
End If

Set the default for the control to 3 dp.
 
what about on displaying the report
 
Try using similar code on the on_format event of the detail (or wherever the control is) section. The syntax is essentially the same as the form example. ie

If Val(Right(Me.NameOfCurrencyControl,1)) > 0 then
Me.NameOfCurrencyControl.DecimalPlaces = 3
Else Me.NameOfCurrencyControl.DecimalPlaces = 2
End If
 

Users who are viewing this thread

Back
Top Bottom