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!

Can't print form parameter on report

Status
Not open for further replies.

samyers

Technical User
Mar 15, 2007
15
US
I have a form, frmReports, with two fields: txtReportBegDate and txtReportEndDate. I use this to pass the date parameters to the query that is the record source for my report. The query works fine so I'm sure the parameters are being passed.

However, I want to use those parameters as part of the title on my report. I've tried using a text box with the value ="Transactions Entered Between " & forms!frmReports.txtReportBegDate & " And " & forms!frmReports.txtReportEndDate. I've also tried a text box with just the control name. I get one of two results: either #Name?, or an error that says 'Can't find the field forms!frmReports.txtReportEndDate referred to in your expression'.

I've done this before but it's been years ago. Can anyone point out what I'm doing wrong?

Thanks!
 
Have you tried using the Expression builder to catch any possible errors?
 
Are you closing the form after opening the report?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Remou - yes, I've used the Expression Builder to eliminate typos

dhookom - no, I'm not explicitly closing the form - the OnClick property of the 'Run the Report' button on the form just opens the report.
 
Does code in your report close the form? What happens if you open the debug window (Press Ctrl+G) and enter the control source:
? forms!frmReports.txtReportBegDate


Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
OK, got it...

When I used the Expression Builder to add the fields, I was selecting from the 'Loaded Forms' tree rather than the 'All Forms'. Selecting the form field from 'All Forms' lets the dates appear on the report. Guess I need to understand an option before I select it.

Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top