Calling a Form from a Report

If you open the report and then open the form it will still need to essentially requery the report to add the parameters.

The report's open event fires before the report runs the query that the report is based on, right? If so, then there wouldn't be any requerying.

It's kind of hilarious to me that we're having this discussion right now because I am working on a database in which I had originally gone the form-opens-report route, but then I was talking to a friend and they said that they had just gone through some Access training at work and they learned to go the report-opens-form route. After hearing that, I thought about it, and it made more sense to me to do it that way for the reasons I outlined above. Now I don't know which road to take! Perhaps this is all just a matter of personal preference. :)


Duluter
 
The other issue is that you will then have each report calling the form. If you have 5 reports you want to run, the code for the report will open the form each time (yes, you can hide it but then you have to use code to check to see if it IsLoaded and I can multiselect the reports I want along with passing the parameters and then they all open. Can you do that with the report opens form? No...
 
Bob, I think you may have convinced me. :)


Duluter
 
I've always just had the form which selects the report be the same which selects the parameters so you can do it all from one location and then open it up.
So, from your base form (switchboard), you might have a button that says, essentially, Choose a Report, then that opens up a form that has the parameter pulldowns/textboxes and a series of buttons, and each button corresponds to a particular report they can run?

Isn't it ever a challenge to give a good description of the report group on the switchboard? What if many of these reports are only tangentially related but happen to use the same parameters?


Duluter
 
Duluter, that in a nutshell is the art of Access Programming - choosing the right approach that is best for a particular case. Only you as designer know that in a particular case.
 
In one app, i use a form to set report options, and then open the report. i close the form and save any parameters in global variables.

i inherited an app that does it the other way - a form carries a do report button, but the open event for the report THEN opens a parameter form to get its input. it works fine, but it took me a while to see what was going on.

i am used to the former, and will continue to do it that way, but i think perhaps its just a matter of what you are used to

indeed, in terms of object orientation and all the things that go with that, surely the parameter form SHOULD be a function of the report, so if you were trying to provide (encapsulate) a report class, surely you would treat any parameter selections as part of the report code, and not the other way round.
 
from Bob

The other issue is that you will then have each report calling the form. If you have 5 reports you want to run, the code for the report will open the form each time (yes, you can hide it but then you have to use code to check to see if it IsLoaded and I can multiselect the reports I want along with passing the parameters and then they all open. Can you do that with the report opens form? No...

here's one bob

in a major app i have (hundreds of forms/reports), i have a reports table giving a english description, and the actual report name, and a report group lookup.

i then have a single reporting form offering all these reports, grouped by report group
ie

sales reports
cost reports
representative reports
month end reports
rebate reports
etc etc


users can set up their own report groups etc

at the top of the report generator i offer selection criteria - date ranges, operating branch, customer selection etc

i even added to that a report queue facility - users can prepare their own report queues - and add any number of selected reports to each queue, they then set overall criteria, and then run the queue which runs each report in sequence. - useful for preparing a series of several month end reports which are always generated together.

------------
i certainly agree that all this is hard to do if "report opens form"
 

Users who are viewing this thread

Back
Top Bottom