Microsoft Office 2000/Visual Basic Programmer's Guide   

Working with Reports, Forms, and Data Access Pages

Microsoft Access provides three objects you can use to display data to the user: reports, forms, and data access pages. Although these objects have many similar features, they are used in different ways.

Note   This section discusses working with forms, reports, and data access pages, but not the data underlying them. For more information about creating a relational database and using ADO and DAO to work with the data stored in a database, see the chapters in Part 3, " Working with Data in Office Solutions."

You use reports to display formatted data. The user cannot edit or add data to a report. Reports can be viewed in the database where they were created or printed. You can also save reports as snapshot files so they can be viewed outside an Access application. For more information about working with snapshot files, search the Microsoft Access Help index for "report snapshots."

You can also use forms to display data to users. But the real power of forms comes from their ability to collect data from users or let users add new records or edit existing records. Forms can also be printed or saved as reports or data access pages.

Note   Although Microsoft Access hosts VBA just like the other Office applications, it uses its own built-in forms package. UserForms are not available in Access.

Data access pages combine the features of forms and reports so that you can display data to users and let users interact with data through Microsoft Internet Explorer version 5 or later. (You can also use other Web browsers to display data access pages, but users will not be able to work with the data directly.) Although you design data access pages by using Access, you save them to disk as separate files designed to be used in a Web browser, which means users can work with Access data from within an Access database or over an intranet or the Internet. Data access pages can contain data in an Access database (.mdb file) or Access project (.adp file).

Access forms, reports, and data access pages have numerous properties, methods, and events you can use to specify how the object will look and behave. A complete discussion of all properties, methods, and events is beyond the scope of this section. For information about a specific property, method, or event, search the Microsoft Access Visual Basic Reference Help index for the name of the item you want information about.

You can use the Application object's CreateForm, CreateReport, and CreateDataAccessPage methods to programmatically create forms, reports, and data access pages. You can also add controls to these objects through VBA code, but unless you are building an add-in or a wizard, you typically create these objects by using the Access user interface and then display them from code. When you display an object, you can use various properties of the object to specify the records it will contain.