Advice / Opinion re: saving queries (1 Viewer)

Valery

Registered User.
Local time
Today, 01:45
Joined
Jun 22, 2013
Messages
363
Hi everyone,

Would like your opinion(s)/advice as to when do you decide to save a query for a report vs having the codes saved within the report?

It is just when you plan to use that query more than for the one report? Or are there other considerations?

Thank you!
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 09:45
Joined
Jul 9, 2003
Messages
16,285

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 09:45
Joined
Jul 9, 2003
Messages
16,285
The basic idea is you create the SQL statement separate from your report, usually in a form designed to generate lots of different reports. On this form you have a button that opens the report. When the report opens the Report automatically received the name of the form that opened it. The report then looks in that form and finds the SQL statement for itself, this means you can create many variations on the SQL statement in your form.

If you think about it, a report is basically a way of displaying a certain set of Fields from a table. The set of fields to display rarely changes. Once you have a Report set up nicely, you will probably use the same Report layout for many different types of reports in your project.

Using this method means that instead of having multiple reports with slightly different record sources, you have only one report, you feed it many different record sources. In other words you have one report to maintain not many. This is an important design principle because if you have to make a minor change to the detail of the report and the report is used in the generation of 20 different reports then it's one change instead of 20 changes. It's a principle which you should adopt in your MS Access development.
 
Last edited:

Valery

Registered User.
Local time
Today, 01:45
Joined
Jun 22, 2013
Messages
363
Thank you Gizmo. Good links too.
 

Users who are viewing this thread

Top Bottom