Hi Mimmo,
Done as told but don't know what to substitute the "Id = " & Me.ID
for?
Tried "MSDS_Attachment" and "Current record" and a few others all to no avail. Any ideas?
With current record it printed out all the records with product_name, Manufacturer and the attachment (icon only) and saved the attachment to C:\temp.
Have also adjusted the Shell to reflect file path & version of Adobe Reader. (?)
Have copied the code as below.
Cheers Kevin
Private Sub Command7_Click()
Dim rstCurr As Recordset
Dim rstAll As Recordset2
Dim fldAttach As DAO.Field2
Set rstCurr = Me.RecordsetClone
rstCurr.FindFirst "Id = " & Me.ID ' substitute the bold fields
Set rstAll = rstCurr.Fields("MSDS_Attachment").Value
Set fldAttach = rstAll.Fields("FileData")
strFilePath = "c:\Temp" & rstAll.Fields("FileName")
If Dir(strFilePath) <> "" Then
VBA.SetAttr strFilePath, vbNormal
VBA.Kill strFilePath
End If
fldAttach.SaveToFile "c:\temp"
Shell "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe " & strFilePath, vbMaximizedFocus
SendKeys "^p~", True
SendKeys "%{F4}", True
End Sub