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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

#Name? error multiple page reports

Status
Not open for further replies.

DreamerZ

Programmer
Jul 11, 2001
254
US
I have reports that get data from forms (button click opens the form, user selects the criteria, and user clicks a button to generate the report). The form data is used in the query for the report.

The report works fine.

I have a label in the page header of the report to display the date range the user selected on the form. The first page of the report shows these dates fine. The pages after the first show a "#Name?" error?

Why is that and how can I fix it?

Just for reference, the dates selected are not stored anywhere and the form closes after the button click to generate the report. I have tried keeping the form open, but that doesn't work either.

TIA.


DreamerZ
 
Well, it's almost certainly due to closing the form but this will probably help.

At the top of a VBA Module (any module in the database will do), under the Option statements declare two variables

Public sDate
Public eDate

In the click event for the button on your form before you do anything else, put this

Code:
sDate = Me.BeginnigDateField  'the names of your textboxes
eDate = Me.EndingDateField
Rest of Code to Open Report and Close Form

Then in the Format Event for your PageHeader in the Report put
Code:
Me.TextboxName1 = sDate
Me.TextboxName2 = eDate

Of course you will need to substitute the appropriate names of your textboxes, but this should fix the problem.

Paul





 
After 10 minutes of playing with this thing, I realized I hadn't put the public variables in a MODULE! DOH!

Anyway, got it working. Thank you very much.

DreamerZ

DreamerZ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top