My code creates a email and attaches some images to the email.
The images are stored in File_Location folder.
The hyperlink to the images are stored in the TblQcFiles table.
Some of the images have been archived into sharepoint, so are no longer in the folder, but the hyperlink is still in the TblQCFiles table.
This causes the code to stop running and give me the error -2147024893
How can i get the code to check that the files still exist before trying to add them to my email ?
Problem is if the images are not in this folder, the code stops running.
The images are stored in File_Location folder.
The hyperlink to the images are stored in the TblQcFiles table.
Some of the images have been archived into sharepoint, so are no longer in the folder, but the hyperlink is still in the TblQCFiles table.
This causes the code to stop running and give me the error -2147024893
How can i get the code to check that the files still exist before trying to add them to my email ?
Problem is if the images are not in this folder, the code stops running.
Code:
If Nz(DCount("*", "tblQCFiles", "Job_ID=" & Forms!Frmmain.tbJobID), 0) > 0 Then
Set Index = CurrentDb.OpenRecordset("SELECT * FROM tblQCFiles WHERE Job_ID=" & Forms!Frmmain.tbJobID & " ORDER BY Date_Added;")
If Not Index.EOF Then
Index.MoveFirst
While Not Index.EOF
i = i + 1
ReDim Preserve AttArray(i)
AttArray(i - 1) = Nz(Index("File_Location"), "")
Index.MoveNext
Wend
End If
Index.Close
Set Index = Nothing
End If