checking the total input hours for a day

lamha

Registered User.
Local time
Today, 17:38
Joined
Jun 21, 2000
Messages
76
I have a form that need the user to enter in their assigned projects, the date, and the hours they work on each project for that day. What I want to do is to check if the total work hours for that day is >24 hours, then we display an error message.
Does anyone know a way to do this? Any help would be appreciated.
 
Sounds to me like (and I could be wrong) you need to put a textbox on your form that does the calculation for you. You should be able to hide that textbox from view. Then do an on-exit macro, or other type, that will do, basically, "if the value in the textbox is greater than 24, give this error message..." Hope this helps. If you need more detail, perhaps someone else has something similar. Regret to say I don't have time to do and tell you how to do it too. Good luck.
 
First, create a hidden text box that calculates the total time spent for the day. Call this TotalTime.

Second, create a label called Warning with its visible property set to No. Place your warning comments in this box.

On the After Update of the TotalTime textbox, place the following code:

Private Sub TotalTime_AfterUpdate()
If TotalTime >24 Then
Label: Warning.Visible = True
InputTime.SetFocus
Else
Me.Warning.Visible = False

End If

End Sub

I have included a SetFocus that will take the user back to the InputTime field for a correction. Change the field name accordingly.

Good Luck.
 

Users who are viewing this thread

Back
Top Bottom