I have an Access DB with OLE Object fields and i'm looking for a way to export / saveas those embedded objects (pictures) as jpeg files. Is this possible to do? If so, how would I go about programming it? Can I do it in either Access or VB6?
Only if the pictures are stored in their original long binary format in the OLE (long binary) field.
Then you would use the ADO Stream object or the GetChunk method.
If they are stored as a converted (embedded) OLE object, (via the OLE container control or in the MS ACCESS application), and not in the original binary format, then you can only use an OLE Container control to display the pictures.
You can then invoke the application associated with the file type and from there save the picture to a file.
You can save this converted OLE Object also to a file, but it can only be read as such.
There may be another method to save it in the original format. I don't know. Most users save the pictures as long binary in their original format, so you might not find alot help with this.
How would I determine the orginal format? I know that the pictures are embedded in the access database, because the database is offline. Would it be in the orginal format if the image will not display in a bound field in an Access form but it will display in a VB6 image field?
I have attempted to use the open statement and can get a file to export but the file will not open. "Photo Editor cannot find or open c:\text.jpg"
Dim fileNM As String
fileNM = InputBox("Enter an image filename:"
fileNM = "c:\" & fileNM
' get the current record
Dim adoRS As ADODB.Recordset
Set adoRS = adoPic.Recordset
Dim bytData() As Byte
ReDim bytData(adoRS.Fields(1).ActualSize)
bytData = adoRS.Fields(1).Value
' save
Open fileNM For Binary Access Write As #1
Put #1, , bytData
Close #1
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.