Programatically change label in Rpt Header with Where Conditions

  • Thread starter Thread starter Joe Bartnicki
  • Start date Start date
J

Joe Bartnicki

I want the label in the Report Header to show the QUERY
and WHERE CONDITIONS that were applied to open the
report. I use a menu with a button to run a VB event
procedure that opens the report with:
Dim stDocName As String
Dim stQueryName As String
Dim stWhereName As String
stDocName = "MyReport"
stFilterName = "MyOPENSQuery"
stLinkCriteria = "[Owner]=" & "'" & Me![Search Owner]
& "'"

DoCmd.OpenReport stDocName, acPreview, stFilterName,
stLinkCriteria

I would like a label field in the Report Header to
read "Open Records with Owner = Fred"

Can anyone give me some sample code that can change label
fields within a report ?

Thank You
 
Set the control source to:
="Open Records with Owner = Fred; SQL=" & ([Forms]!
[YourFormName]![YourSQLString])

(or however you want to format it.)
 
Back
Top