Open Outlook Contact Form from Access Form

G

Guest

I’m trying to create a link on a form that will automatically open that
company’s Outlook contact form. The contact information, notes and history
already exist in Outlook. The database I’m creating in Access will show what
insurance lines that company writes (homeowners, auto, commercial lines,
etc.). There’s no sense duplicating contact info that already exists, and
linking the tables doesn’t solve the problem. Is there a way to just insert
a link for each record on the form that will open that particular company's
Outlook Contact form?

Any assistance would be greatly appreciated!
 
A

Arvin Meyer [MVP]

Jeff in Alaska said:
I'm trying to create a link on a form that will automatically open that
company's Outlook contact form. The contact information, notes and history
already exist in Outlook. The database I'm creating in Access will show what
insurance lines that company writes (homeowners, auto, commercial lines,
etc.). There's no sense duplicating contact info that already exists, and
linking the tables doesn't solve the problem. Is there a way to just insert
a link for each record on the form that will open that particular company's
Outlook Contact form?

Any assistance would be greatly appreciated!

To link Outlook to Access, you can create the entries in Access, using the
code supplied in:

http://www.datastrat.com/Download/OutlookForms2K.zip

Or create them in Outlook and then you'll need to import them into Access:

Private Sub cmdRefreshAccess_Click()

Dim olApp As Object
Dim nsMAPI As NameSpace
Dim ContractorFolder As MAPIFolder
Dim i As Integer
Dim Company As Variant
Dim Contractors As Items

Set olApp = GetObject("", "Outlook.Application")
Set nsMAPI = olApp.GetNamespace("MAPI")
Set ContractorFolder = nsMAPI.Folders("Public Folders").Folders("All Public
Folders").Folders("Contractors")
Set Contractors = ContractorFolder.Items.Restrict("[MessageClass] =
'IPM.Contact.Contractor'")

DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM tblContractor"

For Each Company In Contractors
DoCmd.RunSQL "INSERT INTO tblContractor (ContractorID, ContractorName,
ExchangeEntryID) VALUES ('" & Company.FileAs & "', """ & Company.CompanyName
& """, '" & Company.EntryID & "');"
Next

DoCmd.SetWarnings True

End Sub

Pay particular attention to the ExchangeEntryID which is a 128 character
GUID string, and which is required to link the 2 records. Now to open the
particular record in Outlook, from Access, you'll need some code like:

Private Sub cmdOutlook_Click()
Dim olApp As Object
Dim nsMAPI As NameSpace
Dim ContractorFolder As MAPIFolder
Dim contractor As Object
Dim EntryID As Variant

Set olApp = GetObject("", "Outlook.Application")
Set nsMAPI = olApp.GetNamespace("MAPI")
Set ContractorFolder = nsMAPI.Folders("Public Folders").Folders("All Public
Folders").Folders("Contractors")
EntryID = DLookup("ContractorExchangeEntryID", "tblContractor",
"[ContractorCode] = '" & Me.ContractorCode & "'")

If Not IsNull(EntryID) Then
Set contractor = nsMAPI.GetItemFromID(EntryID, ContractorFolder.StoreID)
contractor.Display
Else
MsgBox ("This customer is not available in the Contractors folder.")
End If
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top