Add contact to outlook 2003 code / strange error message



Hello all,

I now have code working that will add a contact to outlook 2003, however, Microsoft Outlook is giving the following warning message:

"The text or attachments in the current contact's message body will not be copied to the existing contact. If you with to keep the new message body information, select Cancel and make a coyp of it. If you don't need the new information, select OK." with an ok/cancel option.

Anyeone seen this before? Many thanks,

Andy

My save to outlook 2003 code is as follows:
------------------------------------------------
Public Sub saveoutlookcont()
On Error GoTo ErrRtn
' This code is based in Microsoft Access.
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("_ContactsOutlook")
' Set up Outlook objects.
Dim ol As Object 'New Outlook.Application
Dim olns As Object 'Outlook.Namespace
Dim cf As Object 'Outlook.MAPIFolder
Dim c As Object 'Outlook.ContactItem
Dim objItems As Object 'Outlook.Items
Dim Prop As Object 'Outlook.UserProperty
Dim iNumContacts As Long, i As Long

Set ol = CreateObject("Outlook.Application")

Set olns = ol.GetNamespace("MAPI")
Set cf = olns.GetDefaultFolder(olFolderContacts) 'olFolderContacts declared as 10 in declarations section
'Set objItems = cf.Items

'Set itm = itms.Add(strContactForm)
With rst
.MoveFirst
' Loop through the Microsoft Access records.
' Create a new Contact item.
Set c = ol.CreateItem(olContactItem)

'Write values from variables to fields in the new Contact item
If Not IsNull(rst![First Name]) Then c.FirstName = rst![First Name]
If Not IsNull(rst![Last Name]) Then c.LastName = rst![Last Name]
If Not IsNull(rst![Last Name]) And Not IsNull(rst![First Name]) Then
c.FullName = rst![First Name] & " " & rst![Last Name]
End If
If Not IsNull(rst!Address) Then c.BusinessAddressStreet = rst!Address
If Not IsNull(rst!City) Then c.BusinessAddressCity = rst!City
If Not IsNull(rst![State/Province]) Then c.BusinessAddressState = rst![State/Province]
If Not IsNull(rst![ZIP/Postal Code]) Then c.BusinessAddressPostalCode = rst![ZIP/Postal Code]
If Not IsNull(rst![Web Page]) Then c.webpage = rst![Web Page]
If Not IsNull(rst![E-mail Address]) Then c.Email1Address = rst![E-mail Address]
If Not IsNull(rst![Business Phone]) Then c.BusinessTelephoneNumber = rst![Business Phone]
If Not IsNull(rst![Fax Number]) Then c.BusinessFaxNumber = rst![Fax Number]
If Not IsNull(rst!Company) Then c.CompanyName = rst!Company
'rst![Mobile Phone] = c.MobilPhone
'rst![Country/Region] = c.BusinessAddressCountry 'this is proper field, but we dont' have country
c.Save
'MsgBox "Finished."
End With
MsgBox "Exported current contact to MS Outlook.", vbInformation, "Export Complete"
rst.Close
Set ol = Nothing
Exit Sub
ErrRtn:
If Err = 3270 Then 'property not found
Resume Next
Else
MsgBox "Instant Quote Pro could not import from your previous version of Outlook. The exact error that was encountered was:" & Chr(10) & Chr(10) & Err.Number & " - " & Err.Description & ", Function: ImportContactsFromOutlook", vbExclamation, "Could not import from Outlook 2003 or below"
End If
Exit Sub
End Sub

.



Relevant Pages

  • Codeanpassung für Einsatz unter Windows Server 2003?
    ... Dim iAntwort As Integer ... If Len= 0 Then ... 'Aktives Outlook ansprechen... ... MsgBox "Zugriff auf Outlook wurde verweigert. ...
    (microsoft.public.de.word.vba)
  • Codeanpassung für Windows 2003 Server?
    ... Dim iAntwort As Integer ... If Len= 0 Then ... 'Aktives Outlook ansprechen... ... MsgBox "Zugriff auf Outlook wurde verweigert. ...
    (microsoft.public.de.word.vba)
  • Codeanpassung für Windows 2003 Server?
    ... Dim iAntwort As Integer ... If Len= 0 Then ... 'Aktives Outlook ansprechen... ... MsgBox "Zugriff auf Outlook wurde verweigert. ...
    (microsoft.public.de.word.vba)
  • Re: DocOutlook Landkarte Deutschland
    ... Informationen von Smarttools Outlook Weekly vom 11/19/25.02.2004 ... Karten und Routenplanung direkt aus Outlook aufrufen, ... ByVal Inspector As Inspector) Dim cb As CommandBar Dim mnu As ... ByVal lpOperation As String, _ ...
    (microsoft.public.de.outlook)
  • Re: importing from Outlook to Access or vice versa
    ... You can use Automation to export contact data from Access to Outlook. ... the Microsoft DAO x.xx Object Library (where x.xx is the version appropriate ... Dim rsCont As DAO.Recordset ... > to type it twice? ...
    (microsoft.public.access.externaldata)