C
Closemofo
Hello,
I have this code which allows me filter a report.
But I can use only one combo box at the same time.
I would like to be able to filter by using both combo box.
I would like by after adding a text box which search on a field
AutoNumber.
Thank you in advance for your answers.
Yves
-----------------------------------------------------
Private Sub cmdOpenReport_Click()
Dim strWhere As String
Dim strReport As String
strReport = "rpt Operator"
If Not IsNull(Me.Operator) Then
strWhere = strWhere & "[Operator] = '" & Me![cmbOperator].Value & "'"
End If
If Not IsNull(Me.cmbOperatorCity) Then
strWhere = strWhere & "[Operator City] = '" &
Me![cmbOperatorCity].Value & "'"
End If
DoCmd.Close
DoCmd.OpenReport strReport, acViewPreview, , strWhere
Exit Sub
GestionErr:
If Err.Number = 2501 Then Exit Sub
MsgBox "Erreur : " & Err.Number & " " & Err.Description,
vbCritical, "Report Filter"
Exit Sub
End Sub
I have this code which allows me filter a report.
But I can use only one combo box at the same time.
I would like to be able to filter by using both combo box.
I would like by after adding a text box which search on a field
AutoNumber.
Thank you in advance for your answers.
Yves
-----------------------------------------------------
Private Sub cmdOpenReport_Click()
Dim strWhere As String
Dim strReport As String
strReport = "rpt Operator"
If Not IsNull(Me.Operator) Then
strWhere = strWhere & "[Operator] = '" & Me![cmbOperator].Value & "'"
End If
If Not IsNull(Me.cmbOperatorCity) Then
strWhere = strWhere & "[Operator City] = '" &
Me![cmbOperatorCity].Value & "'"
End If
DoCmd.Close
DoCmd.OpenReport strReport, acViewPreview, , strWhere
Exit Sub
GestionErr:
If Err.Number = 2501 Then Exit Sub
MsgBox "Erreur : " & Err.Number & " " & Err.Description,
vbCritical, "Report Filter"
Exit Sub
End Sub