Hi,
Any idea why my logerror function is intermittently logging err.description = {blank} and err.num=0, see stuff in bold near end of code below. I can't figure out why it would even get to the error handler without having an error number and description. Any ideas?
Any idea why my logerror function is intermittently logging err.description = {blank} and err.num=0, see stuff in bold near end of code below. I can't figure out why it would even get to the error handler without having an error number and description. Any ideas?
Private Sub JobComplete_AfterUpdate()
Dim strSetupName As String, dTime As Date
Dim ActualRunHrs As Double, StdHrs As Double
If errorhandlingon Then On Error GoTo ErrHandle 'added 11/13/06
If JobComplete = False Then
If MsgBox3("You are changing a completed job back to uncomplete. Are you sure???", "OK,Cancel", "Un-complete this job?", , , Normal, 30000, 2, True) = 2 Then Me.JobComplete = True
Form_Current
Exit Sub
End If
If (SMTSideQty = 2 And IsNull(ActualFinishTime2)) Or IsNull(ActualFinishTime1) Then
msgboxautoclosedialog "You must enter start and completion times!", "Missing times", 30000
JobComplete = False
Text22.SetFocus
Exit Sub
End If
If ActualRunQty <> RunQty And IsNull(ctlComments.Value) Then
msgboxautoclosedialog "You've entered a run quantity different from the scheduled run qty. Please explain in the 'reason / comments' area.", "Enter a reason", 30000
ctlComments.SetFocus
strSetupName = DLookup("smtsetupname", "Latestrevmaster1", "Noun='" & Me.Noun & "'")
Me.HrsPerRun = Me.ActualRunQty * DLookup("runsecsperunit", "SMT_ABC", "smtsetupname='" & strSetupName & "'") / 3600
JobComplete = False
Exit Sub
End If
dTime = NowCorrected()
If Text22.Value > dTime Or Text24.Value > dTime Or Text46.Value > dTime Or Text47.Value > dTime Then
msgboxautoclosedialog "Time can't be in the future!", "Time can't be in the future", 60000
JobComplete = False
Text22.SetFocus
Exit Sub
End If
If ActualStartTime1 > ActualFinishTime1 Or ActualStartTime2 > ActualFinishTime2 Or (Not IsNull(ActualFinishTime1) And IsNull(ActualStartTime1)) Or (Not IsNull(ActualFinishTime2) And IsNull(ActualStartTime2)) Then
msgboxautoclosedialog "Completion time must be later than start time!", "Completion time earlier than start time", 15000
'
JobComplete = False
Text22.SetFocus
Exit Sub
End If
If IsNull(ActualRunQty) Then
msgboxautoclosedialog "You must enter a run quantity!", "No run qty", 15000
JobComplete = False
Text19.SetFocus
Exit Sub
End If
If ActualRunQty = 0 Then
If MsgBox3("You are completing this job with a run qty of zero. Is this correct?", "Yes,No", "Run Qty of zero?", , , Normal, 30000, 2) = 2 Then
JobComplete = False
Text19.SetFocus
Exit Sub
End If
End If
'ok to here
If ActualRunQty > 2000 Then
If MsgBox3("You are completing this job with a run qty of " & Me.RunQty.Value & ". Run qty's above 2000 are rare. Is this correct?", "Yes,No", "Large Run Qty?", , , Normal, 30000, 2) = 2 Then
JobComplete = False
Text19.SetFocus
Exit Sub
End If
End If
ActualRunHrs = 24 * (ActualFinishTime1 - ActualStartTime1 + Nz(ActualFinishTime2, 0) - Nz(ActualStartTime2, 0))
'changed 10/3/06
StdHrs = DFirst("runtimemultiplier", "constants", "valuestream='" & Me.SMTLine.Value & "'") * Nz(DLookup("totalsecsperunit", "machinetimesperunit", "noun='" & Me.Noun & "'"), 60) * Me.ActualRunQty / 3600
If ActualRunHrs > StdHrs And (IsNull(Me.prob) Or Me.prob = 0) Then
msgboxautoclosedialog "Run time exceeds standard time. You must enter a problem code." & vbCrLf & _
"Standard time: " & getelapsedtime(StdHrs / 24) & vbCrLf & _
"Actual time: " & getelapsedtime(ActualRunHrs / 24), "Enter a problem code", 30000
JobComplete = False
Me.prob.SetFocus
Exit Sub
End If
If IsNull(Me.JobCompleteOperator) Then
msgboxautoclosedialog "You must enter an employee ID for the person completing the job", "Enter Emp ID", 30000
JobComplete = False
Me.JobCompleteOperator.SetFocus
Exit Sub
End If
'DoCmd.GoToRecord , , acNext
'changed 8/7/07
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Form_Current
Exit Sub
ErrHandle:
Select Case Err.Number
Case 2105 'cant go to next record, must already be at last record, so go to first instead
DoCmd.GoToRecord , , acFirst
Case Else
msgboxautoclosedialog "Error #" & Err.Number & " :" & Err.Description & vbCrLf & _
"Please notify Vickie.", , 30000
LogError Err.Description, "Actuals:JobComplete AfterUpdate", Err.Number
End Select
End Sub