Add the snippet in your module.
Requirements:
- 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 SetRSBlob function
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 ExtractBlob function
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 :) (I hope I will not get banned for posting my site.. haha)
Anyway, enjoy and have a happy coding..
Peace out.. :)