Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Date Label Based on Form Controls?

Status
Not open for further replies.

misscrf

Technical User
Jun 7, 2004
1,344
US
I have form controls that allow a user to choose the following filters for a report:

+ check box for year to date
+ combo box to choose a month/year
+ text box to enter a date to be greater than or equal to
+ text box to enter a date to be less than or equal to
+ use both above text boxes for a range.

It all works fine, but now I want a label to dynamically show the date based on the one chosen in the form.

I tried to make an unbound text box control on the report and put this:

Code:
=IIf([Forms]![frmCarSummaryRpt]![ChkYearToDate]=-1,"Year to Date",

IIf([Forms]![frmCarSummaryRpt]![cboMonthYear] Is Not Null,[Forms]![frmCarSummaryRpt]![cboMonthYear],

IIf([Forms]![frmCarSummaryRpt]![dtRangeBegin] Is Not Null And [Forms]![frmCarSummaryRpt]![dtRangeEnd] Is Null,[Forms]![frmCarSummaryRpt]![dtRangeBegin] & " and Later",

IIf([Forms]![frmCarSummaryRpt]![dtRangeBegin] Is Null And [Forms]![frmCarSummaryRpt]![dtRangeEnd] Is Not Null,[Forms]![frmCarSummaryRpt]![dtRangeEnd] & " and Earlier",

IIf([Forms]![frmCarSummaryRpt]![dtRangeBegin] Is Not Null And [Forms]![frmCarSummaryRpt]![dtRangeEnd] Is Not Null,[Forms]![frmCarSummaryRpt]![dtRangeBegin] & " - " & [Forms]![frmCarSummaryRpt]![dtRangeEnd],

"No Date Filter")))))

I doesn't seem to work. No error, just doesn't show the labels I am trying to show. Anyone know how to do this, please?

Thanks!



misscrf

It is never too late to become what you could have been ~ George Eliot
 
I would probably add a text box (possibly invisible) on the form that is valued with a little code rather than a complex IIf() statement. Then your report can reference the hidden text box value.

Duane
Hook'D on Access
MS Access MVP
 
Should the code be behind the form or the report? I tried working with openargs, but I think I am missing something in how openargs works.



misscrf

It is never too late to become what you could have been ~ George Eliot
 
The code would be in the form. I would write a function and call it in the after update of each control or in the code that opens the report.

You could also send the correct string in the OpenArgs.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top