I’m trying to pass a label to unbound textboxes on the report to show what the parameters are. But I’m finding that the unbound textboxes will show up sometimes and not other times in report view and/or print preview. And I have tried the Display When property. (I haven’t tried actually printing.)
It worked fine for a single month when I was using a field in the underlying query to format the parameter month. I just bound the textboxes to that field in the query. But now it’s a more complicated format because if the Start and End months are the same (i.e. reporting 1 month) it should be “mmmm yyyy” but if they are different it should be “mmm-yyyy to mmm-yyyy”.
So the method I ended on constructs the appropriate report label right on the parameter form, then I pass that value to the unbound textboxes in the report header and page footer. Unfortunately I’m still getting the same results.
Here’s the code I’m using in the parameter form:
Code: Select all
sRptLabel = Me.txtReportLabel
sWhere = "SvcMonth Between " & dStart & " And " & dEnd
DoCmd.OpenReport ReportName:="rptMonthly", View:=acViewReport, _
WhereCondition:=sWhere
Reports!rptMonthly.txtLabel = sRptLabel
Reports!rptMonthly.txtFooterLabel = sRptLabel
Reports!rptMonthly.Requery
DoCmd.Close acForm, Me.Name