A
allie357
I keep getting this error: Compile error sub or function not defined. I
think it has to do with the addition of the option group but I don't
understand what is messing up...
Here is my code:
Code:
--------------------------------------------------------------------------------
Private Sub RunReport_Click()
Dim strRCName As String
Dim strDeptName As String
Dim strDate As String
Dim strWhere As String
Dim strDoc As String
' Build criteria string for RCName field
If IsNull(Me.CboRCName.Value) Then
strRCName = "Like '*'"
Else
strRCName = "='" & Me.CboRCName.Value & "'"
End If
' Build criteria string for DeptName field
If IsNull(Me.cboDeptName.Value) Then
strDeptName = "Like '*'"
Else
strDeptName = "='" & Me.cboDeptName.Value & "'"
End If
' Build criteria string for Doc field
SelectCase Me.FraDoc.Value
Case 1
strDoc = "='No Contract'"
Case 2
strDoc = "='No PO'"
Case 3
strDoc = "='No Contract and No PO'"
Case 4
strDoc = "Like '*'"
End Select
' Build the WHERE clause.
strDate = "[DateEntered] Between #" & Me!txtStartDate & _
"# And #" & Me!txtEndDate & "#"
'Strip off the leading " AND "
If Len(strWhere) > 0 Then
strWhere = Mid(strWhere, 6)
End If
' Combine criteria strings into a WHERE clause for the filter
strWhere = "[RCName] " & strRCName & " AND [DeptName] " &
strDeptName _
& " AND [MissingDocumentation] " & strDoc & " AND " & strDate
DoCmd.OpenReport "rpt_Violations_by_RC_x Violations", _
acViewPreview, , strWhere
End Sub
think it has to do with the addition of the option group but I don't
understand what is messing up...
Here is my code:
Code:
--------------------------------------------------------------------------------
Private Sub RunReport_Click()
Dim strRCName As String
Dim strDeptName As String
Dim strDate As String
Dim strWhere As String
Dim strDoc As String
' Build criteria string for RCName field
If IsNull(Me.CboRCName.Value) Then
strRCName = "Like '*'"
Else
strRCName = "='" & Me.CboRCName.Value & "'"
End If
' Build criteria string for DeptName field
If IsNull(Me.cboDeptName.Value) Then
strDeptName = "Like '*'"
Else
strDeptName = "='" & Me.cboDeptName.Value & "'"
End If
' Build criteria string for Doc field
SelectCase Me.FraDoc.Value
Case 1
strDoc = "='No Contract'"
Case 2
strDoc = "='No PO'"
Case 3
strDoc = "='No Contract and No PO'"
Case 4
strDoc = "Like '*'"
End Select
' Build the WHERE clause.
strDate = "[DateEntered] Between #" & Me!txtStartDate & _
"# And #" & Me!txtEndDate & "#"
'Strip off the leading " AND "
If Len(strWhere) > 0 Then
strWhere = Mid(strWhere, 6)
End If
' Combine criteria strings into a WHERE clause for the filter
strWhere = "[RCName] " & strRCName & " AND [DeptName] " &
strDeptName _
& " AND [MissingDocumentation] " & strDoc & " AND " & strDate
DoCmd.OpenReport "rpt_Violations_by_RC_x Violations", _
acViewPreview, , strWhere
End Sub