What type of field do you use for the picture? Since it's Access, I will assume it is OLE Object which will resolve in VB terms to a Field object of type adLongVarBinary.
IN other lanuages this would be called a BLOB (but tha't not important right now - hehe).
I have posted a method from one of my apps which does something similar to what you want. Beware that this code will not function as is - it is provided for you to get soe ideas only.
The important bits are:
1) Size an array of byte to either a specific chunk size or like in my case, directly to the size of the BLOB. (In my case I am certain that the Access DB will only contain JPG's less that 50KB)
2) retrive the chunk(s) from the BLOB and dump them to disk
3) Now treat the dumped file anyhow you like.
I believe there is enough in there to get you started.Code:Function ReadDIBField(fld As ADODB.Field) As cDIBSection
Dim picDIB As New cDIBSection
On Error GoTo err_read
Dim myvar As Variant
Dim tmpFile As String
Dim mSize As Long
mSize = fld.ActualSize
ReDim bits(mSize - 1) As Byte
myvar = fld.GetChunk(mSize)
bits = myvar
If mySettings Is Nothing Then
tmpFile = "c:\test.pic"
Else
tmpFile = mySettings.InternalTempFile
End If
'now put the file to disk and loadJPG it
Dim f As Long
f = FreeFile
' wipe the tmp file
On Error Resume Next
Kill tmpFile
On Error GoTo err_read
Open tmpFile For Binary As #f
Put #f, , bits
Close #f
' load the file (it was a JPG in the DB)
LoadJPG picDIB, tmpFile
Set ReadDIBField = picDIB
Exit Function
err_read:
' to make sure the cdibsection has a chance to free
Set ReadDIBField = Nothing
End Function
Regards
