silentwolf
Active member
- Local time
- Today, 09:28
- Joined
- Jun 12, 2009
- Messages
- 575
Hi guys,
just wondering what I need to do to be able to get the ContID from Access Database into Outlook Contacts?
I got a code which would transfer an Access Contact at present just from a form as a test to Outlook Contacts that works fine.
But as I like to add all Contacts from Access to Outlook and then work with appointments and so forth in future I need to Access ContID also in Outlook Contacts.
Therefore I created a custom Field in Outlook Named ContID
it works fine but how would I be able to add a ContID to it it raise an Error when trying to send the ContID of the txtContID
Does the ContID need to be on the Form in Outlook?
And if it does how can I add it to the form?
Or do I need to use the EntryID from Outlook and then refere back to the Database with the same EntryID ?
Hope someone can give me a hint how to overcome this?
Many thanks for your help!!
just wondering what I need to do to be able to get the ContID from Access Database into Outlook Contacts?
I got a code which would transfer an Access Contact at present just from a form as a test to Outlook Contacts that works fine.
But as I like to add all Contacts from Access to Outlook and then work with appointments and so forth in future I need to Access ContID also in Outlook Contacts.
Therefore I created a custom Field in Outlook Named ContID
Code:
'this code was profidet by a user named database in a https://www.access-o-mania.de/forum/index.php?topic=13596.0
Dim oAppl As Outlook.Application
Dim oNS As Outlook.Namespace
Dim oMAPIFolder As Outlook.MAPIFolder
Dim oContact As Outlook.ContactItem
Dim strSpezialordner As String
'----------------------------------
'Definiert deinen speziellen Ordner
strSpezialordner = "Spezial" 'DeinOrdnername durch den Namen ersetzen, den du in den Outlook-Kontakten als Unterordner vergeben hast
'----------------------------------
On Error GoTo errHandle
If Not IsNull(Me.txtVorname) And Not IsNull(Me.txtNachname) Then
Set oAppl = CreateObject("Outlook.Application")
Set oNS = oAppl.GetNamespace("MAPI")
' 'Den speziellen Ordner zum Beschreiben vorbeitreiten
' Set oMAPIFolder = oNS.GetDefaultFolder(olFolderContacts).Folders(strSpezialordner)
'Den speziellen Ordner zum Beschreiben vorbeitreiten
Set oMAPIFolder = oNS.GetDefaultFolder(olFolderContacts)
'Kontakteintrag hinzufügen
Set oContact = oMAPIFolder.Items.Add
With oContact
.ContID = Me!txtContID
.LastName = Me!txtNachname
.FirstName = Me!txtVorname
.Save
End With
Me!txtContID = Null
Me!txtNachname = Null
Me!txtVorname = Null
Else
MsgBox "Es wurden nicht alle erforderlichen Eingaben gemacht!"
Exit Sub
End If
exitHere:
Set oContact = Nothing
Set oMAPIFolder = Nothing
Set oNS = Nothing
Set oAppl = Nothing
Exit Sub
errHandle:
MsgBox "Es ist ein Fehler beim Zugriff auf Outlook aufgetreten! """
Resume exitHere
it works fine but how would I be able to add a ContID to it it raise an Error when trying to send the ContID of the txtContID
Does the ContID need to be on the Form in Outlook?
And if it does how can I add it to the form?
Or do I need to use the EntryID from Outlook and then refere back to the Database with the same EntryID ?
Hope someone can give me a hint how to overcome this?
Many thanks for your help!!