I do this often - it's quite important for the user looking at her reports to know what conditions she specified. Information about the criteria should be put in a VBA module; I usually structure a new type with just the items needed, then declare apublic variable of the type, thus: Type param
Assignee As String
BeginningDate As Date
EndingDate As Date
Group As String
OpenHood As Integer
Resolution As String
SortCriteriaCombination As Integer
End Type
Public Parameter As param
When the user clicks the "report" button in the form, the specifications are copied into the public variable, thus:
If IsNull(Me.BeginningDate) _
Then
Parameter.BeginningDate = 0
Else
Criterion = Criterion & " and [Open Time] >= DateValue('" & Me.BeginningDate & "')"
Parameter.BeginningDate = Me.BeginningDate
End If
The Report_Open procedure in the report's VBA reads the public parameter and constructs an appropriate header text thus:
If Parameter.BeginningDate = 0 And Parameter.EndingDate = 0 _
Then
Specification.Caption = "For All Dates"
Else
If Parameter.BeginningDate = 0 _
Then
Specification.Caption = "For Dates Through " & Parameter.EndingDate
Else
If Parameter.EndingDate = 0 _
Then
Specification.Caption = "For Dates From " & Parameter.BeginningDate
Else
Specification.Caption = "For Dates From " & Parameter.BeginningDate _ & " Through " & Parameter.EndingDate
End If
End If
End If
Please note that the "caption" property is not suggested by VBA, but it is accepted and it does work. "The specification" I have used is declared on the report as a label.