Chapter 8. Creating Reports and Web-Enabled Output
Chapter 7 explored various ways to work with external data sources, such as linking, importing, or exporting data. In this chapter, I cover:
Creating reports programmatically and how to output data from Access databases in ways that can be used over the Web. For example, you will explore how to set the record source for a report dynamically.
Creating reports programmatically.
Using the
OutputTomethod to export data to various Web formats, such as HTML, ASP, and data access page files.
Working with Reports from VBA
Reports can be manipulated in numerous ways from VBA code. For example, you can change the data source on which the report is based from within VBA code. You can also create reports from scratch or modify existing reports from within VBA code. Let's look at a few examples to further illustrate these concepts.
Many of the examples in this chapter that deal with manipulating existing reports use the Northwind database. If you want to create those particular examples yourself, open the Northwind database and add a new module. Only the code for the Try It Out examples are included in the sample code available on
Wrox.comfor this chapter.
Setting the Report Data Source
The DataSource property of a Report object can be specified as a SQL statement. Suppose you have an existing report called Alphabetical List of Products. The following procedure illustrates one way you can modify the DataSource of the report.
Sub ModifyExistingReport() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access