Online Book Reader

Home Category

Access Cookbook - Ken Getz [307]

By Root 1872 0
and smart tags that expire.

In this chapter you'll learn how to use the smart tags that ship with Access to look up financial data and to access Outlook contacts and scheduling. You'll also learn how to create your own custom smart tags and how to deploy them with your application.

16.1. Use the Built-in Smart Tags


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?

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

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]

TIP

If you are attaching a smart tag to a combo box control, then the data displayed in the combo box will be used, not the data in the bound column.

You can add smart tags to label, text box, and combo box form 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

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.asp

To learn other techniques for working with Outlook, see Recipe 12.8 in Chapter 12.

16.2. Display Multiple Smart Tags on Multiple Forms


Problem


I have a table in my database that is used for many forms. I'd like to use the Person Name smart tag as well as the Date smart tag on the LastName field. I have already created the forms. How can I create multiple smart tags on LastName without having to create them separately on each form?

Solution


It's understandable that you might want to use the Date smart tag in conjunction with the Person smart tag. Fortunately, Access easily supports assigning multiple smart tags to a control on a form or a field in a table.

You can take two actions with the built-in Date smart tag:

Schedule a meeting.

Display your calendar.

If you create a smart tag on a field in a table, then any forms you create subsequently will inherit the smart tag. The documentation states that

Return Main Page Previous Page Next Page

®Online Book Reader