Private Sub LstFiles_DblClick(Cancel As Integer) If Not IsNull(Me.LstFiles) And Not Me.LstFiles = "" Then Dim myrs As New ADODB.Recordset Dim Stream As String, ImageData As String Dim binaryStream As New ADODB.Stream myrs.Open "SELECT * FROM tblFileStore WHERE FileID = '" & Me.LstFiles & "'", CurrentProject.Connection, adOpenKeyset, adLockReadOnly 'Specify stream type - we want To save binary data. binaryStream.Type = adTypeBinary 'Open the stream And write binary data To the object binaryStream.Open binaryStream.Write myrs("FileData") binaryStream.SaveToFile "C:\" 'Start HTML generation Stream = "<Html><head></head><body>" Stream = Stream & "<img src=" & """" & "data:image/" & myrs("filetype") & ";base64," & encodeBase64(binaryStream.Read) & """" & ">" Stream = Stream & "</body></html>" Me.FileBrowser.Document.Open Me.FileBrowser.Document.Write Stream Me.FileBrowser.Document.Close Me.FileBrowser.Refresh On Error Resume Next myrs.Close Set myrs = Nothing On Error GoTo 0 binaryStream.Close End If End Sub
FileBrowser
LstFiles_DblClick
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)