Click here to Skip to main content
14,766,145 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm Using VBA MS ACCESS What is File Browser in this code ? where can i find it

Please Help ↓

actually i don't know what is the file browser ? is that reference or ActivX

What I have tried:

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
Posted
Updated 12-Jan-21 21:43pm
v2
Comments
F-ES Sitecore 6-Jan-21 13:21pm
   
It will be something defined elsewhere on the form, maybe a control called FileBrowser.

1 solution

Without having an access to the project we can't tell what FileBrowser is.

I guess that it's a custom class or ActiveX component. I have found discussion about LstFiles_DblClick procedure in this thread: [SOLVED] Display Image from Binary data without writing to file[^], which seems to be exactly the same as yours.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900