G
Guest
Hi
I have attached below some VB code i am using on the on click property of a
button on one of my database forms.
When i run the code and compare it against the log in and log out times it
gives me the wrong answers. For example if the log in time was before 11:00am
and the log out was before 17:00 the field tmpadjusment should be 10 but the
code keeps skipping straight through to the else.
Dim tmpLog_In_Time, tmpLog_Out_Time As Variant
Dim tmpAdjustment As Integer
Dim tmpLogging_Out As Boolean
tmpLog_In_Time =
Forms!frmFactory_Menu!fsubFactory_Menu!txtLast_Live_Log_In
tmpLog_Out_Time = Now()
tmpLogging_Out = Forms!frmFactory_Menu!fsubFactory_Menu!txtLog_In_Status
DoCmd.Echo False
DoCmd.SetWarnings False
' If Forms!frmFactory_Menu!fsubFactory_Menu!txtLog_In_Status Then
If tmpLogging_Out Then
tmpAdjustment = 0
' The person is now logging out
If tmpLog_In_Time <= #11:00:00 AM# Then
If tmpLog_Out_Time > #5:00:00 PM# Then
tmpAdjustment = 20
Else
tmpAdjustment = 10
End If
Else
If tmpLog_Out_Time > #5:00:00 PM# Then
tmpAdjustment = 10
Else
tmpAdjustment = 0
End If
End If
I would appreciate any help.
Thanks
I have attached below some VB code i am using on the on click property of a
button on one of my database forms.
When i run the code and compare it against the log in and log out times it
gives me the wrong answers. For example if the log in time was before 11:00am
and the log out was before 17:00 the field tmpadjusment should be 10 but the
code keeps skipping straight through to the else.
Dim tmpLog_In_Time, tmpLog_Out_Time As Variant
Dim tmpAdjustment As Integer
Dim tmpLogging_Out As Boolean
tmpLog_In_Time =
Forms!frmFactory_Menu!fsubFactory_Menu!txtLast_Live_Log_In
tmpLog_Out_Time = Now()
tmpLogging_Out = Forms!frmFactory_Menu!fsubFactory_Menu!txtLog_In_Status
DoCmd.Echo False
DoCmd.SetWarnings False
' If Forms!frmFactory_Menu!fsubFactory_Menu!txtLog_In_Status Then
If tmpLogging_Out Then
tmpAdjustment = 0
' The person is now logging out
If tmpLog_In_Time <= #11:00:00 AM# Then
If tmpLog_Out_Time > #5:00:00 PM# Then
tmpAdjustment = 20
Else
tmpAdjustment = 10
End If
Else
If tmpLog_Out_Time > #5:00:00 PM# Then
tmpAdjustment = 10
Else
tmpAdjustment = 0
End If
End If
I would appreciate any help.
Thanks