Hi everyone,
I need a Basic Macro to read a SVG file stored as a BLOB field in MySQL and set it as the new image displayed by an Image Control, in my case in a Base Report.
I know this is possible because Base can generate reports reading the information from the BLOB field, but I need to be able to replace the image with something else. Most the the examples I saw online relate to images stored in the hard drive, which is not my case.
I am able to read the blob object from the database result set and get a reference to the Image Control, but I am stuck there:
Sub Report(oEvent as Object)
Dim report as Object
Dim reportImage as Object
Dim resultSet as Variant
Dim connection as Object
Dim statement as Object
Dim statementContent as String
Dim newImageBlob as Variant
connection = oEvent.Source.Model.Parent.ActiveConnection
statement = connection.createStatement
statementContent = // SELECT STATEMENT HERE
resultSet = statement.executeQuery(statementContent)
resultSet.next()
newImageBlob = resultSet.getBlob(1) // The Image Blob
report = ThisDatabaseDocument.ReportDocuments.getByName("MyReport").open
reportImage = report.GraphicObjects.getByName("Image1") // The Image Control
// How do I replace reportImage's image with newImageBlob?
report.close(true)
End Sub
If replacing the image is not possible, how can I create a new ImageControl with the new SVG and replace the one in the report?
Thank you!