Number format

K

k.roberts

I am entering a number in a field that will be a multiple of .25 - the
number is automatically rounding itself up to the nearest 1 e.g. 0.75
becomes 1 - how can I stop this from happening? Also, how can I set up
a validation rule to ensure that the number being entered is a multiple
of 0.25?
 
G

Guest

For the rounding problem, use the text box's (not a field, only tables and
queries have fields, forms have controls) Format property try #,#0.00

For the multiple of .25, you can use the Mod operator. The only problem is
that the Mod operator will return a divide by zero error if the right (divide
by) number is < 1, so multiple everything by 100 and try something like this
in the Before Update event of the control:

If (Me.MyTextBox * 100) Mod 25 <> 0 Then
MsgBox "Not a Multiple of .25"
End If
 
K

k.roberts

Thanks, I have tried changing the number format to the suggested but
the number still keeps rounding up. Any other suggestions?
 
G

Guest

What is the number type of the table field your control is bound to? If it
is integer or long, then it will do that. Integers and Longs do not have
decimal places. Try chaning it to Single or Doulbe.
 
J

John Spencer

Check the number field's field size and make sure you have it set to
something that will allow a decimal portion - such as Double or Single. If
the field size has the word "Integer" in it then you will only be able to
store integer (whole) numbers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top