By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,401 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,401 IT Pros & Developers. It's quick & easy.

Outlook contacts and Access

P: n/a
A2003, WinXP

I know it is possible to link the Outlook contacts table to Access. Is
it possible to call/open the Outlook Contacts window form within Access?
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Salad" <oi*@vinegar.com> wrote in message
news:V1*******************@newsread1.news.pas.eart hlink.net...
A2003, WinXP

I know it is possible to link the Outlook contacts table to Access. Is it
possible to call/open the Outlook Contacts window form within Access?


Are you looking at automation? You could look at the following sub which
makes use of a separate module containing a couple of globals. This example
finds a single contact - but you could call the .Display method of the
folder without finding a contact.
Another possibility is the Outlook view control.

Sub ShowContact()

On Error GoTo Err_Handler

Dim olContact As Outlook.ContactItem
Dim olFolder As Outlook.MAPIFolder

If Not InitializeOutlook Then
MsgBox "Cannot initialize Outlook", _
vbExclamation, _
"Automation Error"
Exit Sub
End If

Set olFolder = g_nspNameSpace.GetDefaultFolder(olFolderContacts)

Set olContact = olFolder.Items.Find("[FirstName] = ""Elvis"" AND " & _
"[LastName] = ""Presley""")

If Not olContact Is Nothing Then
olContact.Display
Else
MsgBox "Cannot find contact", vbInformation
End If

Exit_Handler:

On Error Resume Next

If Not olFolder Is Nothing Then
Set olFolder = Nothing
End If

If Not olContact Is Nothing Then
Set olContact = Nothing
End If

Exit Sub

Err_Handler:
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler

End Sub

' ******************** Start modOutlook *********************
Option Compare Database
Option Explicit

Public g_nspNameSpace As Outlook.NameSpace

Public g_olApp As Outlook.Application
'
'

Function InitializeOutlook() As Boolean

On Error GoTo Err_Handler

If g_olApp Is Nothing Then
Set g_olApp = New Outlook.Application
Set g_nspNameSpace = g_olApp.GetNamespace("MAPI")
InitializeOutlook = True
Else
InitializeOutlook = True
End If

Exit_Handler:
Exit Function

Err_Handler:
' No Error message - simply let the function return false
Resume Exit_Handler

End Function
' ******************** End modOutlook *********************
Nov 13 '05 #2

P: n/a
Eric Schittlipz wrote:
"Salad" <oi*@vinegar.com> wrote in message
news:V1*******************@newsread1.news.pas.eart hlink.net...
A2003, WinXP

I know it is possible to link the Outlook contacts table to Access. Is it
possible to call/open the Outlook Contacts window form within Access?

Are you looking at automation? You could look at the following sub which
makes use of a separate module containing a couple of globals. This example
finds a single contact - but you could call the .Display method of the
folder without finding a contact.
Another possibility is the Outlook view control.


Thank you. I'll explore this further.

Sub ShowContact()

On Error GoTo Err_Handler

Dim olContact As Outlook.ContactItem
Dim olFolder As Outlook.MAPIFolder

If Not InitializeOutlook Then
MsgBox "Cannot initialize Outlook", _
vbExclamation, _
"Automation Error"
Exit Sub
End If

Set olFolder = g_nspNameSpace.GetDefaultFolder(olFolderContacts)

Set olContact = olFolder.Items.Find("[FirstName] = ""Elvis"" AND " & _
"[LastName] = ""Presley""")

If Not olContact Is Nothing Then
olContact.Display
Else
MsgBox "Cannot find contact", vbInformation
End If

Exit_Handler:

On Error Resume Next

If Not olFolder Is Nothing Then
Set olFolder = Nothing
End If

If Not olContact Is Nothing Then
Set olContact = Nothing
End If

Exit Sub

Err_Handler:
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler

End Sub

' ******************** Start modOutlook *********************
Option Compare Database
Option Explicit

Public g_nspNameSpace As Outlook.NameSpace

Public g_olApp As Outlook.Application
'
'

Function InitializeOutlook() As Boolean

On Error GoTo Err_Handler

If g_olApp Is Nothing Then
Set g_olApp = New Outlook.Application
Set g_nspNameSpace = g_olApp.GetNamespace("MAPI")
InitializeOutlook = True
Else
InitializeOutlook = True
End If

Exit_Handler:
Exit Function

Err_Handler:
' No Error message - simply let the function return false
Resume Exit_Handler

End Function
' ******************** End modOutlook *********************

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.