data entry: preventing certain decimals

S

scubadiver

The database I am developing contains working hours and the hours are always
rounded up or down to the nearest quarter.

What I need is a message which alerts the user when they enter anything
other than X.25hrs, X.5hrs, X.75hrs or X.00hrs (where X is any other number).

Based on the knowledge I have I guess I would use the "after update" event.

thanks in advance.
 
K

Klatuu

The After Update event is too late. Use the Before Update event so you can
cancel the update if the entry is incorrect.

If (Me.txtHours - Int(Me.txtHour))*100 mod 25 <> 0 Then
"Must be .00, .26, .5, or .75"
Cancel = True
End If
 
S

scubadiver

just what I needed.

Cheers


Klatuu said:
The After Update event is too late. Use the Before Update event so you can
cancel the update if the entry is incorrect.

If (Me.txtHours - Int(Me.txtHour))*100 mod 25 <> 0 Then
"Must be .00, .26, .5, or .75"
Cancel = True
End If
 
Top