Using Sample Databases and Forms

I created Events and Tasks databases from the new templates and imported the relevant tables and forms from these databases into the sample database for this chapter, Outlook Export.accdb, and then renamed the objects and controls with appropriate prefixes.

Microsoft has created several new database templates for Access 2007; one of them cre-

yififfii&BBCAai«- ates an Events database, and another creates the Tasks database. See the "Creating a Database from a Template" sidebar for full details on how to locate a database template and create a database from it.

Personally I prefer to maintain my calendar and task list in Outlook, because it has the richest interface for working with appointments and tasks. However, if you want (or need) to maintain a simple calendar or task list in Access, you might want to use these new sample databases, or import objects from them, into your database. You can examine the forms I imported from the sample databases by selecting them from the Forms section on the main menu of the Outlook Export database, as shown in Figure 8.10 (the imported forms end with "List").

FIGURE 8.10

Selecting a form from the main menu.

Selecting a form from the main menu.

Figure 8.11 shows the Task List form, and Figure 8.12 shows the Event List form.

FIGURE 8.11

The Task List form, imported from a database created from the new Tasks database template.

FIGURE 8.11

FIGURE 8.12

The Event List form, imported from a database created from the new Events database template.

FIGURE 8.12

The Outlook Export.accdb sample database contains the tables, queries, forms, and code used in this chapter.

There is also a Contact List form (in the Tasks sample database), shown in Figure 8.13. This form is only suitable for maintaining a simple flat-file contact list, and it lacks most of the special features Outlook provides for working with contacts, but again there are circumstances where you might want (or need) to keep contact information in a single Access table, such as when you need to regularly export basic contact data to a text file or worksheet for distribution via email, or for export to a mainframe flat-file database.

FIGURE 8.13

The Contact List form, imported from a database created from the new Tasks database template.

EH frmContactList

_ o X

Ht

Contact List |

New Contact! Collect Data vis Email Add From Outlook E-mail List Print List laskList

* (New)

Last Name »1 First Name » E-mail Address * Business Phone

Company

Job Title - 1

Zabar

Susan

susez isbb.com

Bert's Beanery

Chief Cook

1

|l of 1 1 ► w (■■■ 1 t, il ' - , 1 Isearch

These forms from the new templates have buttons with embedded macros. The Add from Outlook button, which uses a new command argument, acCmdAddFromOutlook, opens a Select Names dialog for selecting a contact from Outlook, as shown in Figure 8.14.

FIGURE 8.14

Selecting a contact from Outlook.

Select Names to Add: Contacts Search: »'Name © Al Fields

Address Book

T Advanced Find

Display Name

E-mail Address

Hans Hubers Harald Bosse Hariyanto

Harriette Armstrong Harriette Armstrong Harriette Fields Harriette Fields Harriette Goldwater Harriette Goldwater

Harriette Harrington Harriette Pruitt Harriette Pruitt Harriette Trujillo

Hans Hubers {[email protected],, Harald Bosse ([email protected]) Hariyanto {[email protected],co.id) Harriette Armstrong ([email protected], Harriette Armstrong (Business Fax) Harriette Fields ([email protected] Harriette Fields (Business Fax) Harriette Goldwater ([email protected] Harriette Goldwater (Business Fax)

hubers @hubersmultir [email protected], de hariyanto @ptsi .co, id [email protected] Harriette Armstrong^ [email protected]| | Harriette Fields @+l harrietteg @widgetco Harriette Goldwater í

Harriette Harrington ([email protected],,. [email protected]

Harriette Harrington (Business Fax) Harriette Harrington i

Harriette Pruitt ([email protected],, [email protected]

Harriette Pruitt (Business Fax) Harriette [email protected]+1

Harriette Trujillo ([email protected], [email protected]

Harriett*» Tri riilln fRi icin^cc Fay'l_Harripttp Tri riillnlffJ-1

, ¡L : y. ¡-^ .jSj1', ^jv All of these forms from the new database templates use the new embedded macros

S^k®*™""® instead of VBA code for various purposes. Using macros instead of code seems to me to be a step back to the earliest days of Access, but embedded macros do have the advantage of avoiding security problems that can occur if you try to run code that is not signed with a digital signature (or even when you run signed code, in Windows Vista). For simple tasks, such as closing a form or running a command or two, embedded macros work fine, but for more complex tasks, they won't do the job; you still need to write VBA code to perform complex tasks such as iterating through a recordset or creating new objects in other Office applications.

I also imported reports from the Tasks and Events databases, which you can view by selecting the report name from the Reports section of the sample databases main menu, shown in Figure 8.15.

FIGURE 8.15

Selecting a report from the main menu.

FIGURE 8.15

Selecting a report from the main menu.

Depending on what type of printer you have, you may have to adjust the margins on some of these reports to avoid error messages when opening them.

0 0

Post a comment