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?
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"
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.
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.
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]
|
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
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.