Sorry I answered too quickly... realpath is a php function... please ignore my previous response.
In ASP it is Server.MapPath(), but if you already have the full path in the database, that shouldn't be the issue.
Are you using the same recordset for the loops as the attachments? Is it possible the path is wrong in one of them?