Hi Group
I am trying to add an outlook contact from my access database. This code is attached to the OnClick event of a command button and works fine….it adds the contact and enters in the full name. Problems start happening when I try to add additional fields within the WITH statement. I get an Error 438 message – Object doesn’t support this property or method. Does anyone have any ideas???
Thanks for your input
Private Sub AddOLContact_Click()
On Error GoTo AddAppt_Err
'Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
'Exit the procedure if appointment has been added to Outlook
If Me!AddedToOutlook = True Then
MsgBox "This appointment already added to Microsoft Outlook"
Exit Sub
'Add a new appointment
Dim outobj As Outlook.Application
Dim outappot As Outlook.ContactItem
Set outobj = CreateObject("outlook.application")
Set outappt = outobj.CreateItem(olContactItem)
With outappt
FullName = Me.FName & " " & Me.LName

End With
End If
'Release the Outlook object variable
Set outobj = Nothing

'Set the AddedToOutlook flag, save the record, display a message
Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Contact Added!"
Exit Sub
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub

End Sub