Recipe 16.1 Use the Built-in Smart Tags
16.1.1 Problem
How can I enable a user to scroll through a list of names on a form
and launch Outlook's Contacts dialog box, so that
the user can add the selected person as a contact?
16.1.2 Solution
You can use the built-in Person smart tag to add or change
contact information stored in Microsoft Outlook. The
Person smart tag allows you to take
the following actions:
- Send an email message to a contact.
- Schedule a meeting with a contact.
- Open and edit a contact's information.
- Add the name in the control to your list of contacts.
It's very easy to add the Person smart tag to a
label, text box, or combo box control on a
form by following these steps:
- Open frmEmployees in 16-01.mdb in design view, select the FullName
text box, and press F4 to bring up the Properties window. Click the
Data tab and click to the right of the Smart Tags option to load the
Smart Tags dialog box. - Select the Person Name checkbox, as shown in Figure 16-1, and click OK. This will add the following
text to the SmartTags option in the dialog box:"urn:schemas-microsoft-com:office:smarttags#PersonName"
Figure 16-1. Adding the Person smart tag to a control on a form
- Display the form in form view and click the control where you added
the smart tag. The sample application contains a form, frmEmployees,
with a smart tag on the Name text box. When you click in the text
box, the smart tag icon is displayed, as shown in Figure 16-2.
Figure 16-2. The Person smart tag displayed in form view
- Selecting the Add to Contacts option will launch
Outlook's new contact window, as shown in Figure 16-3. You can then enter the new contact
information for that person.
Figure 16-3. The name displayed in Access is automatically entered for the new contact
16.1.3 Discussion
When you use a smart tag to enter a new contact in Outlook, the
entire contents of the control are automatically copied to Outlook.
If the form control that has the associated smart tag contains only
the last name, then that is what will be copied to Outlook. If you
want both the last name and first name copied, then create an
expression for the Control Source property:
=[FirstName] & " " & [LastName]
|
controls. Smart tags are not supported for
reports. In addition, you can add smart
tags to the following controls on a Data Access Page:
- Label
- Bound Span
- Text Box
- Scrolling Text
- Drop-down List
- Hyperlink
16.1.4 See Also
For more coverage of working with smart tags in Access 2003, see this
MSDN article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_wd2003_ta/html/odc_wdov.aspTo learn other techniques for working with Outlook, see
Recipe 12.8 in Chapter 12.