Retrieving Data from a Data Source

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The first step in creating a report is determining where the data is located and how to retrieve it. In an Office 2000 solution, your data can come from a variety of places — a relational database such as an Access or SQL Server database, a spreadsheet, a text file, a MAPI store (such as a Microsoft Exchange data source), or a table on a Web page, to name a few. For more information about the types of data sources you can access from an Office solution, see Chapter 14, "Working with the Data Access Components of an Office Solution."

In some cases, a table in your data source contains exactly the data that you want to present. In most cases, however, you need to create a query to retrieve the data you want from a data source. Queries that you create in Office 2000 applications are expressed as statements in Structured Query Language (SQL), which is a universal language for data access from relational data sources.

You can construct an SQL statement by typing it directly into your code. For complex SQL statements, however, you may want to use a tool that allows you to construct the query visually and then copy the corresponding SQL statement. Office 2000 contains several tools that you can use to create SQL statements that you can copy into your code. You can use these tools to create saved queries or temporary queries.