LooprstSourceAttachments.Close
rstTargetAttachments.CloseErrorHandlerExit:
Exit SubErrorHandler:
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 IfEnd SubFunction SplitFileName(strFileAndPath) As StringOn Error GoTo ErrorHandlerDim strFullPath() As String
Dim intUBound As IntegerExtract the file name from the variable with the file and path.
strFullPath = Split(strFileAndPath, “\”, -1, vbTextCompare)
intUBound = UBound(strFullPath)
strFile = strFullPath(intUBound)
SplitFileName = strFileErrorHandlerExit:
Exit FunctionErrorHandler:
MsgBox “Error No: “ & Err.Number & “; Description: “ &
Err.Description
Resume ErrorHandlerExitEnd FunctionFigure 11.16 shows an Outlook contact with an attachment created from an Access contact record.
Synchronizing Access and Outlook Contacts 11