Creating a validation rule for numbers.

G

Guest

I have a numberic field where the number of hours spent on a issue must be
entered. I want the hours recorded in 15 minute increments and end in .00,
..25, .50, .75. How would I write the validation rule?
 
R

Rick Brandt

Tparis said:
I have a numberic field where the number of hours spent on a issue
must be entered. I want the hours recorded in 15 minute increments
and end in .00, .25, .50, .75. How would I write the validation rule?

(([FieldName]*100) Mod 25=0) Or Is Null
 
O

onedaywhen

Rick said:
I have a numberic field where the number of hours spent on a issue
must be entered. I want the hours recorded in 15 minute increments
and end in .00, .25, .50, .75. How would I write the validation rule?

(([FieldName]*100) Mod 25=0) Or Is Null

I assume that 0.751 should fail, however with your rule it does not
e.g.

SELECT 0.751 AS FieldName, IIF((FieldName * 100) Mod 25 = 0, 'Pass',
'Fail')

returns 'Pass'.

I would suggest:

FieldName - INT(FieldName) IN (0.00, 0.25, 0.50, 0.75)

Jamie.

--
 
R

Rick Brandt

onedaywhen said:
I assume that 0.751 should fail, however with your rule it does not
e.g.

SELECT 0.751 AS FieldName, IIF((FieldName * 100) Mod 25 = 0, 'Pass',
'Fail')

returns 'Pass'.

I would suggest:

FieldName - INT(FieldName) IN (0.00, 0.25, 0.50, 0.75)

Yes, that is better.
 

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