Newbie question regarding Number field

  • Thread starter Thread starter michaaal
  • Start date Start date
M

michaaal

How can I adjust my number field so that it ends in either .00, .25, .50, or
..75.
For example...

0.00
0.25
1.25
2.75
10.50
10.75
10.00

Also, I do not want the computer to store the typed value unless it meets
the requirement above. For example, if I type in "2.759385", I don't want
the computer to store the full number and simply display "2.75". I want it
to actually just store the number "2.75".

Thank you!!
 
If you don't want any rounding errors..then you need to use a field type of
currency.

However, to only allow those 4 possible values...you could put the following
code in the before update event:

Dim strText As String

strText = Screen.ActiveControl.Value

strText = Mid(strText, InStr(Me.pamount, ".") + 1)
strText = Left(strText + "00", 2)

Select Case strText
Case "00", "25", "50", "75"
Cancel = False
Case Else
Cancel = True
MsgBox "You must enter .00, or .25, or .50 or .75", vbExclamation
End Select
 
Back
Top