I have seen the other posts in the same vein as this question but I've been unable to solve my problem.
I have a search function and when the search is executed I would like to view reports based solely on the search results.
The code I am using is as follows:
This works fine if I "filter by form" but it does not work with my search function. When I run the search, the total record number decreases but the word "(filtered)" does not appear after it.
This is the filtering code for my search:
Any help is much appreciated
I have a search function and when the search is executed I would like to view reports based solely on the search results.
The code I am using is as follows:
Code:
Dim stDocName As String
stDocName = "Organizational Profile"
If Me.FilterOn And Len(Me.Filter & "") > 0 Then
DoCmd.OpenReport stDocName, acViewPreview, WhereCondition:=Me.Filter
Else
DoCmd.OpenReport stDocName, acViewPreview
End If
Exit_Preview_report_Click:
Exit Sub
End Sub
This is the filtering code for my search:
Code:
Forms![Master Form by Ult Parent].RecordSource = "select * from [Master Form by Ult Parent Query] where " & GCriteria
Forms![Master Form by Ult Parent].Caption = LCaption
Me.FilterOn = True
Any help is much appreciated