Automatically insert decimal IF....

MackMan

Registered User.
Local time
Today, 00:23
Joined
Nov 25, 2014
Messages
174
Hi guys. Thanks for taking the time to read...

I have a currency field, and currently its set to automatically insert a decimal point by /10 if it's notnull. Most of the inputs to this field use pence and shortens the input method.


Someone has asked me if it's possible to insert trailing zeros (set to 2) if they input a decimal at the end, to shorten the imput yet again.

Example being if they input 526388 this currently changes to £5263.88

but if they enter 7152. how can I get the entry to convert to £7152.00


I've tried str (myfield) but the decimal is not recognised.
I've also tried..

Code:
Public Function HowManyDecPlaces(vNum As Variant) As Integer
  Dim arrNum As Variant
      arrNum = Split(vNum, ".")
      If UBound(arrNum) > 0 Then
           HowManyDecPlaces = Len(arrNum(1))
      Else
           HowManyDecPlaces = 0
      End If
End Function
but the value after the decimal must be 1 or more for it to recongise the decimal point....whereas I just want it to recognise the decimal point to insert the two trailing zeros.


As usual, your valuable help is greatly appreciated.
 
See the Change and LostFocust event of the currency field (curr).
 

Attachments

Thanks Arnel. Works perfectly.
 
you're welcom Mack!
 

Users who are viewing this thread

Back
Top Bottom