Expand|Select|Wrap|Line Numbers
- Private Sub cmdIntake_Click()
- Dim strCountyName As String
- Dim strAgencyStatus As String
- Dim strReferalSource As String
- Dim StrServices As String
- Dim StrPOStatus As String
- Dim strFilter As String
- Dim strStaff As String
- Dim strReferalDate As String
- ' HAVE the report auto open for user
- If SysCmd(acSysCmdGetObjectState, acReport, "rptIntakeBilling") <> acObjStateOpen Then
- DoCmd.OpenReport "rptIntakeBilling", acViewPreview
- End If
- ' Build criteria string for CountyName field
- If IsNull(Me.cboCountyName.Value) Then
- strCountyName = "Like '*'"
- Else
- strCountyName = "='" & Me.cboCountyName.Value & "'"
- End If
- ' Build criteria string for AgencyStatus field
- If IsNull(Me.cboAgencyStatus.Value) Then
- strAgencyStatus = "Like '*'"
- Else
- strAgencyStatus = "='" & Me.cboAgencyStatus.Value & "'"
- End If
- ' Build criteria string for ReferalSource field
- If IsNull(Me.cboReferalSource.Value) Then
- strReferalSource = "Like '*'"
- Else
- strReferalSource = "='" & Me.cboReferalSource.Value & "'"
- End If
- ' Build criteria string for Services field
- If IsNull(Me.cboServices.Value) Then
- StrServices = "Like '*'"
- Else
- StrServices = "='" & Me.cboServices.Value & "'"
- End If
- ' Build criteria string for POStatus field
- If IsNull(Me.cboPOStatus.Value) Then
- StrPOStatus = "Like '*'"
- Else
- StrPOStatus = "='" & Me.cboPOStatus.Value & "'"
- End If
- ' Build criteria string for POStaff field
- If IsNull(Me.cboStaff.Value) Then
- strStaff = "Like '*'"
- Else
- strStaff = "='" & Me.cboStaff.Value & "'"
- End If
- ' Combine criteria strings into a WHERE clause for the filter
- strFilter = "[CountyName] " & strCountyName & " AND [AgencyStatus] " & strAgencyStatus & " AND [RefCode] " & strReferalSource & " AND [Service] " & StrServices & " AND [POStatus] " & StrPOStatus & " AND [Staff Initials] " & strStaff
- ' Apply the filter and switch it on
- With Reports![rptIntakeBilling]
- .Filter = strFilter
- .FilterOn = True
- '.txtIntakeReportHeader.Value = _
- '"INTAKE REPORT: " & vbCrLf & "Referal Source: " & Me.cboReferalSource.Value _
- '& vbCrLf & "County: " & Me.cboCountyName.Value _
- '& vbCrLf & "Staff: " & Me.cboStaff.Value
- End With
- End Sub
Thanks Falroc