• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. USING QUERIES TO GET THE MOST... > WORKING WITH QUERIES TO FEED REPORTS...

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 is written. When the code is written, it simply changes the SQL property of the existing QueryDef and opens the report.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint