O'Reilly logo

Access Data Analysis Cookbook by Wayne S. Freeze, Ken Bluttman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Outlook Contacts

Problem

I want to import my Outlook contact list into Access.

Solution

The technique demonstrated in Importing Emails from Outlook can also be used to import your contact list. First, you'll need to create an Access table to hold the imported data. Table 7-4 lists the fields to include.

Table 7-4. Fields in the Outlook contacts table

Field

Data type

Id

AutoNumber

First

Text(255)

Last

Text(255)

Title

Text(255)

Company

Text(255)

Department

Text(255)

Office

Text(255)

Post Office Box

Text(255)

Address

Text(255)

City

Text(255)

State

Text(255)

Zip code

Text(255)

Country

Text(255)

Phone

Text(255)

Mobile Phone

Text(255)

Pager Phone

Text(255)

Home2 Phone

Text(255)

Assistant Phone Number

Text(255)

Fax Number

Text(255)

Telex Number

Text(255)

Display name

Text(255)

E-mail type

Text(255)

E-mail address

Text(255)

Alias

Text(255)

Assistant

Text(255)

Send Rich Text

Yes/no

Primary

Text(255)

Then you need some code to open an ADO Recordset object that can read the Outlook contacts table. Substitute the following code fragment into the routine found in Importing Emails from Outlook:

	Set InTable = New ADODB.Recordset
	InTable.ActiveConnection = "Provider=Microsoft.JET.OLEDB.4.0;" & _
	   "Exchange 4.0;MAPILEVEL=Outlook Address Book\;PROFILE=Outlook;" & _
	   "TABLETYPE=1;DATABASE=c:\temp"
	InTable.Open "SELECT * FROM [Contacts]", , adOpenStatic, adLockReadOnly

The resulting routine will copy all of your contact information into your ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required