Access Database Record to Outlook Contacts

T

Tina F

I am trying to export a selected Access record to my Outlook Contacts. I
want to add a button to my input form that contains First Name, Last Name,
Phone, email, etc and be able to click on it and send the specified
information to Outlook. I found code to send appointment information but not
contact. Any help would be greatly appreciated.

Thank you.
 
D

Daniel Pineault

Here is a basic function that you can customize to suit your exact needs.

Function CreateNewContact(Optional strFolder As String)
'Creates a new contact entry in the specified folder
'Requires reference to Outlook be set

'strFolder is the folder in which to create the new contact

Dim olApp As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items

Set olApp = CreateObject("Outlook.Application")
Set myNameSpace = olApp.GetNamespace("MAPI")

If strFolder = "Contacts" Or IsMissing(strFolder) Or strFolder = "" Then
Set objFolder = myNameSpace.GetDefaultFolder(olFolderContacts)
Else
Set objFolder =
myNameSpace.GetDefaultFolder(olFolderContacts).Folders(strFolder)
End If

Set objItems = objFolder.Items
Set ObjAdd = objItems.Add

With ObjAdd 'Create new Contact Entry
.FirstName = "Daniel"
.LastName = "Pineault"
.HomeAddressStreet = "My Address"
.Save
End With


Set objItems = Nothing
Set objFolder = Nothing
Set myNameSpace = Nothing
Set olApp = Nothing

End Function

--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 

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