Use special date handling (a blank date in Outlook is actually a date of 1/1/4501):
If Nz(rstSource![Birthday]) <> “” Then
con.Birthday = Nz(rstSource![Birthday])
Else
con.Birthday = #1/1/4501#
End If
If Nz(rstSource![Anniversary]) <> “” Then
con.Anniversary = Nz(rstSource![Anniversary])
Else
con.Anniversary = #1/1/4501#
End If
Use special handling for attachments, calling another procedure:
Set rstSourceAttachments = _
rstSource![Attachments].Value
If rstSourceAttachments.RecordCount > 0 Then
Call CopyAccessAttsToOutlook(con, _
rstSourceAttachments)
Else
rstSourceAttachments.Close
End If
con.Close (olSave)
strFirstName = “”
strLastName = “”
strCustomerID = “”
NextSourceRecord:
rstSource.MoveNext
Loop
strTitle = “Outlook contacts updated”
strPrompt = “All Outlook contacts in the “ _
& fldContacts.Name & “ folder updated”
MsgBox strPrompt, vbInformation + vbOKOnly, _
strTitle
ErrorHandlerExit:
Exit Sub
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 _
Synchronizing Access and Outlook Contacts 11