Loop
rstSourceAttachments.Close
rstTargetAttachments.Close
ErrorHandlerExit:
Exit Sub
ErrorHandler:
If Err.Number = 3839 Then
‘File already exists; delete it
Kill strFileAndPath
Resume
Else
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit
End If
End Sub
Function SplitFileName(strFileAndPath) As String
On Error GoTo ErrorHandler
Dim strFullPath() As String
Dim intUBound As Integer
Extract the file name from the variable with the file and path.
strFullPath = Split(strFileAndPath, “\”, -1, vbTextCompare)
intUBound = UBound(strFullPath)
strFile = strFullPath(intUBound)
SplitFileName = strFile
ErrorHandlerExit:
Exit Function
ErrorHandler:
MsgBox “Error No: “ & Err.Number & “; Description: “ &
Err.Description
Resume ErrorHandlerExit
End Function
Figure 11.16 shows an Outlook contact with an attachment created from an Access contact record.
Synchronizing Access and Outlook Contacts 11