In general I would guess you need to:
- save the attachment(s) to disk
- use appropriate automation to open/print attachment(s)
Here's some code I use to save attachments:
'Open recordset of attachments, save each one to disk and assign to
attachments() array
For iii = 1 To 9
Attachments(iii) = ""
Next iii
filepath = CurrentDBDir() & "Attachments999\"
If Len(Dir(filepath, vbDirectory)) = 0 Then
MkDir filepath
End If
iii = 1
Set RSAttachments = rs.Fields("Attachments").Value
While Not RSAttachments.EOF
If (FileExists(filepath &
RSAttachments.Fields("FileName").Value)) Then
Kill filepath & RSAttachments.Fields("FileName").Value
End If
RSAttachments.Fields("FileData").SaveToFile filepath
Attachments(iii) = filepath &
RSAttachments.Fields("FileName").Value
iii = iii + 1
RSAttachments.MoveNext
Wend
RSAttachments.Close
Function CurrentDBDir() As String
Dim strDB As String, strCurrentDir As String
strDB = CurrentDb.Name
strCurrentDir = Left(strDB, Len(strDB) - Len(Dir(strDB)))
CurrentDBDir = strCurrentDir
End Function
It saves all the attachments (well, up to 9) that are in the attachments
field in directory attachments999 and populates the attachments() array with
filenames to be used.
Then you need to write the code to do the automation open/print of the
attachments.
I've done a bit of automation code if you require assistance in your
project.
Hope this makes sense and helps you get started,
Doesn't sound like an easy task,
Mark Andrews
RPT Software
http://www.rptsoftware.com
http://www.donationmanagementsoftware.com