HI Guys,
the following code I use works fine in access 2003, but not in access 2010.
I have looked all over the internet for help, but I could not find the answer myself,
so I am asking it here.
Here is the code that works for creating a new contact in outlook 2010 from access 2003:
************************************************** ************************
Private Sub TransferRealtortooutlookbutton_Click()
Dim olApp As New Outlook.Application
Dim olContact As Outlook.ContactItem
If ContactExists(olApp, Nz(Me![REAgentName], "")) Then
Beep
MsgBox "That Realtor is already in your Outlook Contact List"
Exit Sub
ElseIf MsgBox(" Add this Realtor to the contacts in MS Outlook ?", vbYesNo, "Delete") = vbYes Then
Set olContact = olApp.CreateItem(olContactItem)
With olContact
.FullName = Nz(Me![REAgentName], "")
.BusinessAddressCity = Nz(Me![Address1] & " - " & Me![City], "")
.BusinessAddressState = Nz(Me![State], "")
.BusinessAddressPostalCode = Nz(Me![ZipCode], "")
.BusinessTelephoneNumber = Nz(Me![Phone], "")
.Email1Address = Nz(Me![Email], "")
.BusinessFaxNumber = Nz(Me![Fax], "")
.MobileTelephoneNumber = Nz(Me![CellPhone], "")
.HomeTelephoneNumber = Nz(Me![OtherPhone], "")
.JobTitle = "Realtor From EZ Inspection Database - " & Nz(Me![Notes] & " Inspection #: " & Nz(Me![inspection#], ""))
.CompanyName = Nz(Me![CompanyName], "") & "- Insp Add: " & Forms![inspectionmain]![Address1] & " - " & Forms![inspectionmain]![City] & " - " & Forms![inspectionmain]![State]
.Body = Nz(Me![Notes], "") & " :" & Me.email2
.WebPage = Nz(Me![Website], "")
.Save
End With
Beep
MsgBox " Contact Saved to Outlook."
Else
End If
End Sub
************************************************** *************
thanks very much,
kevin rea
Lancaster, calif.