delete the .00 trailing zeros in price

amerifax

Registered User.
Local time
Today, 14:30
Joined
Apr 9, 2007
Messages
304
I am creating my first form and a field that holds a price is showing that as 000000.00 I would like to eliminate trailing zeros and can find nowhere in a properties to do that in form properties.
Bob
 
Set the Decimal Places to 0.

Dale
 
In design view for the form, select the control that contains your price, in the property sheet select the Format tab, you will see Decimal Places where you can set it to 0 and it will not show the decimal portion.

But, if you don't always want the decimal to not show except when it is actually 0, you can dynamically set the number of Decimal Places in the On Current event function.

Code:
If Me.NewRecord Then
Me.Price.DecimalPlaces = 2
Else
    If Me.Price= CInt(Me.Price) Then
        Me.Price.DecimalPlaces = 0
    Else
        Me.Price.DecimalPlaces = 2
    End If
End If
 

Users who are viewing this thread

Back
Top Bottom