Access.2007.VBA.Bibl..

(John Hannent) #1
Nz(.Email3DisplayName)
rstTarget![GovernmentIDNumber] = _
Nz(.GovernmentIDNumber)
rstTarget![Hobby] = Nz(.Hobby)
rstTarget![ManagerName] = Nz(.ManagerName)
rstTarget![OrganizationalIDNumber] = _
Nz(.OrganizationalIDNumber)
rstTarget![Profession] = Nz(.Profession)
rstTarget![Spouse] = Nz(.Spouse)
rstTarget![WebPage] = Nz(.WebPage)
rstTarget![IMAddress] = Nz(.IMAddress)

Use special handling for attachments, calling another procedure:


If .Attachments.Count > 0 Then
Set rstTargetAttachments = _
rstTarget![Attachments].Value
Call CopyOutlookAttsToAccess(con, _
rstTargetAttachments)
End If

rstTarget.Update
.Close (olSave)
End With
End If
Next itm

rstTarget.Close

strTitle = “Outlook table created”
strPrompt = “Table of Outlook contact data (“ _
& strTable _
& “) created and filled with data from the “ _
& fldContacts.Name & “ folder”
MsgBox strPrompt, vbInformation + vbOKOnly, strTitle

ErrorHandlerExit:
Exit Function

ErrorHandler:
‘Outlook is not running; open Outlook with CreateObject
If Err.Number = 429 Then
Set appOutlook = CreateObject(“Outlook.Application”)
Resume Next
Else
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit
End If

End Function

Synchronizing Access and Outlook Contacts 11

Free download pdf