程序代码为:
Public Sub ListView_DblClick()
If ListView.SelectedItem Is Nothing Then Exit Sub
Dim rst As DAO.Recordset
Set rst = CurrentDb().OpenRecordset("Select * from tblexpPhotos where PhotoID=" & Mid(ListView.SelectedItem.key, 3))
Dim PicName As String, FileNo As Long, FileData() As Byte, lngFilelen As Double
PicName = strTempDir & "\" & rst!PhotoID & "." & rst!Ext
If Dir(PicName) = "" Then
FileNo = FreeFile
ReDim FileData(LenB(rst!Photo))
FileData() = rst!Photo
Open PicName For Binary As #FileNo
Put #FileNo, , FileData() '把字段内容保存到文件
Close #FileNo
Erase FileData
End If
Application.FollowHyperlink PicName
End Sub