WORKING WITH QUERIES TO FEED REPORTS AND FORMS

Reports and forms can use QueryDefs or SQL statements as a record source. If the record source will be changed based on complex criteria, it can be helpful to have the report pointing to a QueryDef that contains the SQL statement for the report. VBA code can change the QueryDef before opening the form or report rather than change it during the Form OnOpen or Report OnOpen event.

Creating the QueryDef ahead of time is advantageous because even before the VBA code is written to generate the real QueryDef, you can create a query with the fields that will be used on the final report and begin the report design. This allows you to develop the report and view data from existing tables until the VBA code ...

Get F. Scott Barker's Microsoft® Access 2000 Power Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.