Access VBA Macro Programming

(Joao Candeias) #1

Chapter 9 Forms and Reports


Chapter 9 Forms and Reports


F


orms and reports are the means by which your application interfaces to the user and
communicates the information within the database. In a relational database, the data
is held within tables that can be viewed simply by double-clicking the table name,
but those tables are very unlikely to provide the user with anything meaningful.
This is because the data is stored in a number of tables that have relationships between
them. An example might be customer orders. The customer details would be stored in a
separate customer table and each order would relate to the customer table using an internal
ID number.
If you looked at the customer orders table, all you would see for the customer detail would
be a reference number pointing to a record within the customer details table. To get the full
story, a query is necessary to join the two tables together and present the full information to
the user.
Forms and reports use underlying queries and tables to present the information to the user
in an understandable form. There is plenty of scope for using VBA to enhance both forms
and reports.
The examples in this chapter will use the Northwind database as the source of data. To
load this, click Sample in the central pane (Available Templates) when Access first loads, and
then double-click the Northwind icon.


Forms


A form is based on a table or a query and allows the user to scroll through records, view
specified fields, and use filtering methods. According to how the form properties are set, the
user may be able to edit, update, or delete records on the form.


97

Free download pdf