how do I create warning box if hours are under or over

G

Gunther Dawson

Time heet - how do I calculate hours worked and overtime with a must of 40
hours before overtime can be added.
 
A

Allen Browne

It would be possible to use the BeforeUpdate event procedure of the record
to DSum() the hours for the employee in the week from the records other than
this one, add the hours in this one, see if it comes to 40 (possibly
allowing for floating point inaccuracy), and cancel the event if there's not
enough.

Before you do that though, you might like to consider whether blocking like
that is what you need. It would assume that data entry is always being made
in the correct order. For example, if the data entry person is trying to put
in a claim for 2 hours overtime on Friday, but Thursday's timesheets have
been delayed and she has not received them yet, you will be actually
blocking her from entering valid data. It might be better to use something
like Conditional Formatting to flag the control with a red background if the
hours are not up to 40 yet, rather than to block the entry.

Alternatively, you might design an interface where the user enters the
number of hours into an unbound box, and you programmatically break it down
into normal hours and overtime.
 

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