473,379 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Outlook contacts and Access

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
2 4490

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kurt | last post by:
Hi We are developing an off-the-shelf software suite for a certain business sector. Most of the program is simply a GUI on top of some .mdb files. Its a .net application written in c# One...
4
by: lauren quantrell | last post by:
Is there a way to open the MS Outlook address book using VBA and then be able to do something with the return value? I want users to click an icon to open the Outlook address book then when an...
1
by: SWu | last post by:
Hello everyone, I am working on an Internet website for an Application Service Provider. A user can store employee details on the site. I am now researching the feasibility of accessing the...
5
by: TM | last post by:
I would like to write a little app in Visual Basic .net as an add-in to Outlook 2003 so that I can quickly get a list of contact names and email addresses, then when I click on a name or email...
9
by: George McCullen | last post by:
I have an Outlook 2003 using Exchange Server 2003 Public Contacts Folder containing 20,000 Contacts. I am writing a VB .Net 2003 program that loops through all the contacts in a "for each oCt in...
1
by: charliej2001 | last post by:
Hi all My access database has import/export capabiltiy of contact details between outlook. The database is getting big now (1000+ contacts) and so are the outlook address books that have the...
1
by: Phil Stanton | last post by:
I have a Yacht Club Db with names addresse phone nos, emails etc. I want to export them to Outlook. No problem in getting them into the contact folder. My problem is I have a folder within the...
6
by: Kevin | last post by:
In my business, I use Quickbooks extensively for billing and accounting and a custom built Access DB for project management. I recently began using MS Outlooks contacts quite extensively as well...
3
by: Volkan Senguel | last post by:
Hi Is there a easy way to get the contacts (names and phonenumbers) from outlook without the message that someone is accessing outlook and how long the access can take? i have not found any...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.