Okay .... I finally got this work to with the help of boblarson .... but its acting up and I have no idea ...
I am using the following ...
For some reason .... I cannot add any more time ... I have verify data in the tables ... I and I only have 2.00 hrs logged .. and when I go to enter more time ... the vba kicks and states that I have exceeded when in fact I only have 2.00 hrs of time for the current weekending date ....
Any ideas ...please and thank you in advance
I am using the following ...
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If (Me.PlannedHours) <= 0 Or IsNull(Me.SubActivityDetails) Then
MsgBox ("You must enter your planned hours and provide a description of the activity"), 0, "Weekly Schedule Control System"
Cancel = True
End If
If DSum("[PlannedHours]", "EmployeeWeeklyActivityCommentstbl", "[CommentsDateTimeStamp] Between ([CommentsDateTimeStamp])+7-Weekday([CommentsDateTimeStamp],2) - 7 And ([CommentsDateTimeStamp])+7-Weekday([CommentsDateTimeStamp],2) = " & Me.CurRptWeekendDatetxt + Me.PlannedHours < 34.15) Then
MsgBox ("Your time entry has been saved for the current weekending report " & Format(Forms!AddActivityCommentsfrm!CurRptWeekendDatetxt, "long date")) & vbCrLf & vbCrLf & ("Currently, you have planned for " & Forms!Mainfrm!EmployeeDashboardSubfrm!SumOfPlannedHours & " Hrs"), 0, "Weekly Schedule Control System"
Cancel = False
End If
If DSum("[PlannedHours]", "EmployeeWeeklyActivityCommentstbl", "[CommentsDateTimeStamp] Between ([CommentsDateTimeStamp])+7-Weekday([CommentsDateTimeStamp],2) - 7 And ([CommentsDateTimeStamp])+7-Weekday([CommentsDateTimeStamp],2) = " & Me.CurRptWeekendDatetxt + Me.PlannedHours > 34.15) Then
MsgBox ("You have exceeded your planned hours limit of 34.15 for the current weekending report " & Format(Forms!AddActivityCommentsfrm!CurRptWeekendDatetxt, "long date")) & vbCrLf & vbCrLf & ("Currently, you have planned for " & Forms!Mainfrm!EmployeeDashboardSubfrm!SumOfPlannedHours & " Hrs"), 0, "Weekly Schedule Control System"
Cancel = True
End If
End Sub
For some reason .... I cannot add any more time ... I have verify data in the tables ... I and I only have 2.00 hrs logged .. and when I go to enter more time ... the vba kicks and states that I have exceeded when in fact I only have 2.00 hrs of time for the current weekending date ....
Any ideas ...please and thank you in advance