lamha
07-15-2000, 06:43 AM
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.
Dreamboat
07-16-2000, 09:42 AM
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.
Carol
07-16-2000, 07:50 PM
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.