I have the following code:
Private Sub Append_Click()
On Error GoTo Append_Click_Err
DoCmd.RunCommand acCmdRefresh
DoCmd.Echo True, ""
DoCmd.SetWarnings False
If Me.Job_Num.Enabled = True Then 'Check for a locked job
Beep
MsgBox "Lock The Job Please", vbCritical, "Lock Error"
Else
If DCount("*", "Pouch_Info") = 0 Then 'Check if serial number received
Beep
MsgBox "Serial number not active, please rescan or inform production supervisor.", vbCritical, "Scan Error"
Else
If DCount("*", "Job_Compare") = 0 And DCount("*", "Job_Compare_2") = 0 Then 'Check for already procesed under different job
Beep
MsgBox "Serial number processed under a different job, please rescan or inform production supervisor.", vbCritical, "Scan Error"
Else
If DCount("*", "Job_Compare") = 1 Then 'Check for reprint
Call Reprint 'Call Reprint Private Sub
Else
DoCmd.OpenQuery "Pouch_Update", acViewNormal, acEdit 'Update Job Number
Call Print_Pouch 'Call Print Pouch Private Sub
Me.Ser_Num.SetFocus 'Set focus back to the serial number field
End If
End If
End If
End If
Append_Click_Exit:
Exit Sub
Append_Click_Err:
MsgBox "Call Andy at Extension 247", vbCritical, "ERROR"
Resume Append_Click_Exit
Exit Sub
End Sub
Private Sub Print_Pouch()
DoCmd.OpenReport "Pouch_Label", acViewNormal, "", "", acHidden 'Open label report
DoCmd.OpenQuery "Purge_After_Label", acViewNormal, acEdit 'Clear serial number in form
DoCmd.SetWarnings True
Me.Ser_Num.SetFocus 'Set focus back to the serial number field
End Sub
I cannot get the final set focus command in either code sets to work. When all is done, the form is highlighted in the navigation pane (off to the left side) of the access menu. The focus is not directly on the open form and then not set to the correct field.
Any thoughts?