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

How to create report with varying parameters

Status
Not open for further replies.

paty

Programmer
Dec 6, 2001
7
US
Hello,

I have built a very complicated database for a client in which the user can, among other things, summarize over fields (I am using Visual Basic and SQL to summarize over the data by basically selecting all other parameters except for the one the user has selected to use as a summarization parameter). The resulting recordsets, which I always display on the same form (I just vary its record source through code) could have up to 22 fields but could also be narrowed down by the user to a single field. The client wants to be able to print a report of the resulting recordset at any point in time, but I have not been able to figure out how to do this. In other words, the number of fields can change every time and can be any possible combination of fields at different times. Since when I create a report, it is based on the fields that the recordset I use has at that time, when I summarize over a field and try to reprint the report, I get prompted for the missing parameter(s) even if I change the report's record source. Can anyone give me a tip as to how I can do this? Any help or tips would be appreciated.

Thanks!

Paty
 
Just a thought here. Set a report with the maximum number of empty textboxes possible. Set them to equal the form values of the text boxes on the form and don't close the form whenyou print the report.
 
Thanks for your response, it's a good thought. But since the record source of the form that I am displaying is always changing (and the form has a fixed number of text boxes), when the user has summarized over a parameter, the text box on the form based on that parameter returns the value #Name? To take care of that problem I hide the columns that contain the parameters the user has summarized over. If I based the report on the form I would get the value #Name? on the report as well, is this correct?
 
Change the name of the text box on the form to txtSomeName, and leave the recordsource as is. This should stop the #Name error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top