data entry: preventing certain decimals

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
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
 

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

Back
Top