I keep getting the above error in my code and don't understand why as it has been working for weeks!!!
I have a form with 3 combo boxes that I have been using as a filter for another form. This has been working fine and I don't recall changing anything within the 2 forms recently. Some advice would be greatley received.
Private Sub FILTER_Click()
Dim stDocName As String
Dim stLinkCriteria As String
1 If Me.SHIFT <> "" Then GoTo 2
GoTo 5
2 If Me.DEPARTMENT <> "" Then GoTo 3
GoTo 5
3 If Me.JOB <> "" Then GoTo 4
GoTo 5
4 If SysCmd(acSysCmdGetObjectState, acForm"TrainingDataEntry_Frm") Then
DoCmd.Close acForm, "TrainingDataEntry_Frm", acSaveYes
stDocName = "TrainingDataEntry_Frm"
stLinkCriteria = "[DEPARTMENT]=" & "'" & Me![DEPARTMENT] & "'"
stLinkCriteria = stLinkCriteria & "AND [SHIFT]=" & "'" & Me![SHIFT] & "'"
stLinkCriteria = stLinkCriteria & "AND [JOB]=" & "'" & Me![JOB] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
GoTo 6
5 MsgBox ("Please Enter Criteria into all Boxes")
GoTo 6
6 End If
End Sub
I have a form with 3 combo boxes that I have been using as a filter for another form. This has been working fine and I don't recall changing anything within the 2 forms recently. Some advice would be greatley received.
Private Sub FILTER_Click()
Dim stDocName As String
Dim stLinkCriteria As String
1 If Me.SHIFT <> "" Then GoTo 2
GoTo 5
2 If Me.DEPARTMENT <> "" Then GoTo 3
GoTo 5
3 If Me.JOB <> "" Then GoTo 4
GoTo 5
4 If SysCmd(acSysCmdGetObjectState, acForm"TrainingDataEntry_Frm") Then
DoCmd.Close acForm, "TrainingDataEntry_Frm", acSaveYes
stDocName = "TrainingDataEntry_Frm"
stLinkCriteria = "[DEPARTMENT]=" & "'" & Me![DEPARTMENT] & "'"
stLinkCriteria = stLinkCriteria & "AND [SHIFT]=" & "'" & Me![SHIFT] & "'"
stLinkCriteria = stLinkCriteria & "AND [JOB]=" & "'" & Me![JOB] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
GoTo 6
5 MsgBox ("Please Enter Criteria into all Boxes")
GoTo 6
6 End If
End Sub