Using VBA to Store BLOBS in Database

  • Thread starter Thread starter ASMProComp
  • Start date Start date
A

ASMProComp

Guest
Hello,

I am having a problem storing an image as a Blob in a SQL linked table. Our system uses an Access 2002 frontend and linked to a SQLServer2000 database. I have a form that I want to display a unique client jpeg photo for each client record. Our client HIPAA concerns means we have to store the image not the path in the database field. I am using an Image control on the form. Initially I have been able to load an image from a Windows Dialog into the control and save the path no problem.

My issues are surrounding how to actually save and load the jpeg as a BLOB in a VBA byte Array after the image has been loaded to the form from the dialog box.(Is there some sort of binary conversion needed or does the Append and GetChunk methods handle all this)?:

All the code examples I have been able to find on the subject have a line of code to set the Image control's data source to the open recordset with this statement ---> Set imgDBImage.DataSource = rs. Does this statement work with VBA because DataSource does not show up as a property of an Access 2002 Image Control. So how do I point the Image Control to the table field which contains the BLOB in VBA code?

Finally, how do you convert the string path of the image to binary for storage in a byte Array in VBA. I have the syntax for a VB 6.0 which is..... .Fields("ImageBLOB").AppendChunk bytBLOB. Is the .Fields portion of the code relevant in VBA to tell what table field to write to and does the AppendChunk method handle all the conversion.

Andrew,
 
Do a search on google for ImagesA2K or Access BLOB. I downloaded a nice sample for three methods of storing BLOBS. I cant find the site, but I know its out there. I would like to give credit where credit is do.



I cant remember where I got it from. Hope this helps
 
Last edited:
maybe this will help?
 
I never store a image as a BLOB, I have the user select the file from there computer and I drop it into a folder where the DB is located. I Store the address on a table....

Works great and doesnt bloat the DB
 

Users who are viewing this thread

Back
Top Bottom