A
ArtVandele
Guest
I have the following code assigned to a button. This button is suppose to check to insure a Job Number has been entered and if not return a message to the user.
It works great except for....when there is no Job Number the message appears as it should then that message is followed by "Microsoft Access can't move the focus to the control Command56."
This is driving me crazy. What am I missing?
Private Sub Command56_Click()
On Error GoTo Err_Command56_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
If IsNull(Me![QtNum]) Then
MsgBox "A Job Number must be entered to continue."
DoCmd.GoToControl "Command56"
Else
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmViewEstimate"
stLinkCriteria = "[JobID]=" & Me![JobID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmStartJob"
End If
Forms!frmViewEstimate!cmdNext.Visible = False
Forms!frmViewEstimate!cmdPrevious.Visible = False
Forms!frmViewEstimate!Command76.Visible = False
Exit_Command56_Click:
Exit Sub
Err_Command56_Click:
MsgBox Err.Description
Resume Exit_Command56_Click
It works great except for....when there is no Job Number the message appears as it should then that message is followed by "Microsoft Access can't move the focus to the control Command56."
This is driving me crazy. What am I missing?
Private Sub Command56_Click()
On Error GoTo Err_Command56_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
If IsNull(Me![QtNum]) Then
MsgBox "A Job Number must be entered to continue."
DoCmd.GoToControl "Command56"
Else
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmViewEstimate"
stLinkCriteria = "[JobID]=" & Me![JobID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmStartJob"
End If
Forms!frmViewEstimate!cmdNext.Visible = False
Forms!frmViewEstimate!cmdPrevious.Visible = False
Forms!frmViewEstimate!Command76.Visible = False
Exit_Command56_Click:
Exit Sub
Err_Command56_Click:
MsgBox Err.Description
Resume Exit_Command56_Click