Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim d As DAO.Database
Dim a As DAO.Recordset2
Dim b As DAO.Recordset2
Dim p As String
p = Environ("temp") & "\" & [FileName]
Set d = CurrentDb
Set a = d.OpenRecordset("select * from tblAttachment where id=" & [ID] & ";")
Set b = a.Fields("attachmentFieldNameHere").Value
With b
.MoveFirst
While .Fields("Filename") <> [FileName]
.MoveNext
Wend
If Dir(p) <> "" Then Kill p
.Fields("FileData").SaveToFile p
End With
Set b = Nothing
Set a = Nothing
Set d = Nothing
[yourImageControl].Picture = p
End Sub