Add the snippet in your module.
- Make sure you have reference to M$ ActiveX Data Objects Library (ADODB)
- A table field with OLE Object / BLOB as datatype
- A recordset that is already oppened and ready to be use
To save Image on your table field, call
Make sure that your recordset is already loaded or openned
Lets assume that our recordset
rs is already oppened and ready to be updated.
Dim ret as Boolean ret = SetRSBlob("C:\image1.jpg", rs, "image")
TRUE will be returned if image was set to the recordset field.
All you have to do is call recordset
rs.update function to save it permanently to the table.
To extract the image, just call the
Again, make sure that your recordset is already openned.
Dim ret as Boolean ret = ExtractBlob(rs, "image", "c:\extracted_image.jpg")
It will return true if image was extracted successfully.
Code is not that clean but I hope anyone can enjoy and learn something on it.
I used this code on my church management software which you can download on my website http://silentprojectsoftwares.com/ :) (I hope I will not get banned for posting my site.. haha)
Anyway, enjoy and have a happy coding..
Peace out.. :)