Hello everyone,
I'm trying to filter a report based on previous filter of a subform.
I use this Code to Filter the subform
This works great! But I want to use strWhere to Filter the report too.
If I need to open the report, its simple :
In my case I need to apply the filter to the report without the need to open it!
Any suggestions and Help is highly appreciated!
Have a nice weekend,
Nizar
I'm trying to filter a report based on previous filter of a subform.
I use this Code to Filter the subform
Code:
Private Sub Filter_Click()
Dim strWhere As String
If Not IsNull(Me.Coordinator) Then
'Create Predicate
strWhere = strWhere & " AND " & "Orders.[EmployeeID] = " & Me.Coordinator & ""
End If
If Not IsNull(Me.Customer) Then
'Create Predicate
strWhere = strWhere & " AND " & "Orders.[CustomerID] = " & Me.Customer & ""
End If
If Not IsNull(Me.Supplier) Then
'Create Predicate
strWhere = strWhere & " AND " & "Orders.[SupplierID] = " & Me.Supplier & ""
End If
Me.Track_All_Orders.Form.Filter = strWhere
Me.Track_All_Orders.Form.FilterOn = True
End Sub
This works great! But I want to use strWhere to Filter the report too.
If I need to open the report, its simple :
Code:
Private Sub cmdGenerateReport_Click()
Dim stDocName As String
stDocName = "Statement"
DoCmd.OpenReport stDocName, acPreview, , strWhere
End Sub
In my case I need to apply the filter to the report without the need to open it!
Any suggestions and Help is highly appreciated!
Have a nice weekend,
Nizar