Public Sub loadAttachFromFile(strPath As String, rsAll As DAO.Recordset, attachmentFieldName As String)
'An attachment field has a recordset of attachments stored behind the scenes
Dim rsAtt As DAO.Recordset
'Add a new record to the tables recordset
Set rsAtt = rsAll.Fields(attachmentFieldName).Value
rsAll.Edit
rsAtt.AddNew
'This is the confusing part. The value property of an attachment field returns a recordset of attachments
'All recordset of attachments has a field named filedata which holds the data.
'The loadfromfile data loads an attachment from a path
rsAtt.Fields("FileData").LoadFromFile (strPath)
rsAtt.Update
rsAll.Update
End Sub