To copy data in one field, rather than updating an entire contact record, select either “Access to
Outlook” or “Outlook to Access” in the combo box in the center Copy Field Data section of the
form, as shown in Figure 11.15, where the value “Vice President” in the Access contact record is
being replaced by “Senior Vice President” from the Outlook record. You can also type in new data,
or edit existing data, as needed, before copying the record.
FIGURE 11.15
Copying a single field’s data from Outlook to Access.
If you want to completely remove a contact, select “Mark Record for Deletion” and it will be deleted
when the contacts are updated. When you have finished copying, editing, and marking records for
deletion, the “Update Contact Information” button on the main menu offers you a choice of updat-
ing the Access contacts first, and then the Outlook contacts. All data (including attachments, if any)
from tblOutlookContacts will be copied back to the contacts in the selected Contacts folder, creating
new contacts as needed. The procedure that updates the Outlook contacts is listed here:
Public Sub UpdateAllOutlookContacts()
‘Called from cmdUpdateContactInfo_Click() on fmnuMain
On Error GoTo ErrorHandler
Set appOutlook = GetObject(, “Outlook.Application”)
Set nms = appOutlook.GetNamespace(“MAPI”)
strTable = “tblOutlookContacts”
Set dbs = CurrentDb
Set rstSource = _
dbs.OpenRecordset(strTable, dbOpenDynaset)
Part II Writing VBA Code to Exchange Data between Office Components