Home > Articles > Home & Office Computing > Microsoft Applications

This chapter is from the book

A Preview of the Database Components

As mentioned previously, tables, queries, forms, reports, macros, and modules combine to compose an Access database. Each of these objects has a special function. The following sections take you on a tour of the objects that make up an Access database. The examples use the sample Northwind database to illustrate the use of each object. If you want to follow along, you can create the Northwind database as covered in Chapter 2, “Getting Started with Microsoft Access.” You can log in as any user, which will take you to the Home form. Close the Home form to follow along.

Tables: A Repository for Data

Tables are the starting point for an application. Whether data is stored in an Access database or you reference external data (such as data in an Excel spreadsheet) by using linked tables, all the other objects in a database either directly or indirectly reference tables.

To view all the tables that are contained in an open database, you select Tables from the list of objects available in the database (see Figure 1.1). A list of available tables appears (see Figure 1.2).

Figure 1.1

Figure 1.1. To view the tables in a database, select Tables from the list of available objects.

Figure 1.2

Figure 1.2. You can view the tables contained in a database.

To view the data in a table, double-click the name of the table you want to view. (You can also right-click the table and then select Open.) Access displays the table’s data in a datasheet that includes all the table’s fields and records (see Figure 1.3). You can modify many of the datasheet’s attributes and even search for and filter data from within the datasheet; these techniques are covered later in this chapter.

Figure 1.3

Figure 1.3. A table’s datasheet contains fields and records.

If the table is related to another table (such as the Northwind database’s Customers and Orders tables), you can also expand and collapse the subdatasheet to view data stored in child tables (see Figure 1.4).

Figure 1.4

Figure 1.4. Datasheet view of the Customers table in the Northwind database.

As an Access user, you often want to view the table’s design, which is the blueprint or template for the table. To view a table’s design (see Figure 1.5), right-click the table name in the Navigation Pane, and then select Design View. In Design view, you can view or modify all the field names, data types, and field and table properties. Access gives you the power and flexibility you need to customize the design of tables. Chapter 3, “Tables: The Repository for Your Data,” and Chapter 9, “Creating Your Own Tables,” cover these topics.

Figure 1.5

Figure 1.5. The design of the Customers table.

Relationships: Tying the Tables Together

To properly maintain data’s integrity and ease the process to work with other objects in a database, you must define relationships among the tables in a database. You accomplish this by using the Relationships window. To view the Relationships window, select Relationships from the Database Tools tab of the Ribbon. The Relationships window appears. In this window, you can view and maintain the relationships in the database (see Figure 1.6). If you or a fellow user or developer have set up some relationships, but you don’t see any in the Relationships window, you can select All Relationships in the Relationships group on the Design tab of the Ribbon to unhide any hidden tables and relationships.

Figure 1.6

Figure 1.6. The Relationships tab, where you view and maintain the relationships in a database.

Many of the relationships in Figure 1.6 have join lines between tables and show a number 1 on one side of the join and an infinity symbol on the other. This indicates a one-to-many relationship between the tables. If you double-click a join line, the Edit Relationships dialog box opens (see Figure 1.7). In this dialog box, you can specify the exact nature of the relationship between tables. The relationship between the Customers and Orders tables in Figure 1.7, for example, is a one-to-many relationship with referential integrity enforced. This means that the user cannot add orders for customers who don’t exist. Notice in Figure 1.7 that the Cascade Update Related Fields check box is not selected. This means that if the user cannot update the CustomerID field. Because Cascade Delete Related Records is not checked in Figure 1.7, the user cannot delete from the Customers table customers who have corresponding orders in the Orders table.

Figure 1.7

Figure 1.7. The Edit Relationships dialog box, which enables you to specify the nature of the relationships between tables.

Chapter 10 extensively covers the process to define and maintain relationships. For now, you should establish relationships both conceptually and literally as early in the design process as possible. Relationships are integral to successfully design and implement your application.

Queries: Stored Questions or Actions You Apply to Data

Queries in Access are powerful and multifaceted. A query retrieves data from your database based on criteria you specify. An example is a query that retrieves all employees who live in Florida. Select queries enable you to view, summarize, and perform calculations on the data in tables. Action queries enable you to add to, update, and delete table data. To run a query, first close the Relationship window if you still have it open. Next select Queries from the Objects list and then double-click the query you want to run. Or you can click in the list of queries to select the query you want to run and then right-click and select Open. When you run a Select query, a datasheet appears, containing all the fields specified in the query and all the records meeting the query’s criteria (see Figure 1.8). When you run an Action (Append, Update, Delete, or Make Table) query, Access runs the specified action, such as making a new table or appending data to an existing table. In general, you can update the data in a query result because the result of a query is actually a dynamic set of records, called a dynaset, based on the tables’ data. A dynaset is a subset of data on which you can base a form or report.

Figure 1.8

Figure 1.8. The result of running the Product Orders query.

When you store a query, Access stores only the query’s definition, layout, or formatting properties in the database. Access offers an intuitive, user-friendly tool that helps you design queries: the Query Design window (see Figure 1.9). To open this window, select Queries from the Objects list in the Navigation Pane, choose the query you want to modify, right-click, and select Design View.

Figure 1.9

Figure 1.9. The design of a query that selects data from the Customers table.

The query pictured in Figure 1.9 selects data from the Customers table. It displays the Company, Job Title, Work Phone, Home Phone, and Mobile Phone from the Customers table. Chapter 4, “Using Queries to Retrieve the Data You Need,” Chapter 11, “Enhancing the Queries That You Build,” and Chapter 12, “Advanced Query Techniques,” cover the process of designing queries. Because queries are the foundation for most forms and reports, they are covered throughout this book as they apply to other objects in the database.

Forms: A Means to Display, Modify, and Add Data

Although you can enter and modify data in a table’s Datasheet view, you can’t control the user’s actions very well, nor can you do much to facilitate the data-entry process. This is where forms come in. Access forms can have many traits, and they’re flexible and powerful.

To view a form, you select Forms from the Objects list. Then you double-click the form you want to view or right-click in the list of forms to select the form you want to view and then click Open. Figure 1.10 illustrates a form in Form view. This Customer Details form is actually two forms in one: one main form and one subform. The main form displays information from the Customers table, and the subform displays information from the Orders table (a table related to the Customers table). As the user moves from customer to customer, the form displays the orders associated with that customer. When the user clicks to select an order, the form displays the entire order.

Figure 1.10

Figure 1.10. The Customer Details form, which includes customer, order, and order detail information.

Like tables and queries, you can also view forms in Design view. The Design view provides tools you may use to edit the layout of your form. To view the design of a form, you select Forms from the Objects list, choose the form whose design you want to modify, and then right-click and select Design View. Figure 1.11 shows the Customer Details form in Design view. Chapter 5, “Using Forms to Display and Modify Information,” Chapter 13, “Building Powerful Forms,” and Chapter 14, “Advanced Form Techniques,” cover forms in more detail.

Figure 1.11

Figure 1.11. The design of the Customer Details form.

Reports: Turning Data into Information

Forms enable you to enter and edit information, but with reports, you can display information, usually to a printer. Figure 1.12 shows a report in Preview mode. To preview any report, select Reports from the Objects list. Double-click the report you want to preview or right-click the report want to preview from the list of reports in the Navigation Pane, and then click Open. Notice the report in Figure 1.12. It shows the Monthly Sales Report which outputs the sales by product for a month. If you attempt to run this report, Access loads the Sales Reports Dialog form. Here you select how you want to view the sales, the sales period, and the year, quarter, or month as appropriate. For the example, I selected Sales by Product, Monthly Sales, 2006 for the year, and June for the month. Like forms, reports can be elaborate and exciting, and they can contain valuable information.

Figure 1.12

Figure 1.12. A preview of the Monthly Sales report.

As you may have guessed, you can view reports in Design view, as shown in Figure 1.13. To view the design of a report, select Reports from the Objects list, select the report you want to view, and then right-click and select Design View. Figure 1.13 illustrates a report with many sections; in the figure, which shows the Design view of the Invoice report, you can see the Page Header, Order ID Header, Detail section, Order ID Footer, and Page Footer (just a few of the many sections available on a report). Just as a form can contain subforms, a report can contain subreports. Chapter 7, “Using Reports to Print Information,” Chapter 15, “Building Powerful Reports,” and Chapter 16, “Advanced Report Techniques,” cover the process of designing reports.

Figure 1.13

Figure 1.13. Design view of the Invoice report.

Macros: A Means of Automating a System

Macros in Access aren’t like the macros in other Office products. You can’t record them, as you can in Microsoft Word or Excel, and Access does not save them as Visual Basic for Applications (VBA) code. With Access macros, you can perform most of the tasks that you can manually perform from the keyboard, Ribbon, and QuickAccess toolbar. Macros enable you to build logic in to your application flow.

To run a macro, select Macros from the Objects list, and then double-click the macro you want to run. Or you can right-click the macro and click Run. Access then executes the actions in the macro. To view a macro’s design, you select Macros from the Objects list, select the macro you want to modify, right-click, and select Design View to open the Macro Design window (see Figure 1.14). The macro pictured in Figure 1.14 opens the form called Startup Screen, and then opens the form called Login Dialog. Chapter 17, “Automating Your Database with Macros,” and Chapter 18, “Advanced Macro Techniques,” cover the process of building and working with macros.

Figure 1.14

Figure 1.14. The design of a macro that opens two forms.

Modules: The Foundation of the Application Development Process

Modules, the foundation of any complex Access application, enable you to create libraries of functions that you can use throughout an application. You usually include subroutines and functions in the modules that you build. A function always returns a value; a subroutine does not. By using code modules, you can do just about anything with an Access application. Figure 1.15 shows an example of a module called PurchaseOrders. You can double-click the module in the Navigation Pane to access the module code. This will take you to the Visual Basic Editor (VBE) where you can view and modify the programming code. To return to the Access environment, click the View Microsoft Access toolbar button, or use the Alt-F11 keystroke combination.

Figure 1.15

Figure 1.15. The PurchaseOrders module in Design view, showing the General Declarations section and the Generate and Create functions.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020