what is long binary data in ms access

G

Guest

I have a copy database containing 10,000+ image files but the table shows
'long binary data' in the field and the field type is set to OLE object - How
do I get the picture to display as an image?
Many Thanks
Mike
 
G

Guest

You CAN use MS Access for a D Base with 10,00+ photos BUT ???
Anyway
If you are looking to show the image it would 1st be a good idea NOT to
inbed the photos. Use the "either" choice from the properties (Data - OLE
type allowed) of the OLE object on the form. This way you can simply link to
the picture and so keep the size of the D Base down.

The best way to show the picture would be to save a thumbnail of the picture
as a WMF (metafile) and it is this that you store in the table. If you
really do need to show the full picture to clients are anyone else then link
the WMF (create a path hypelink to the full picture from the thumbnail).

Hope this helps.
 
S

Stephen Lebans

If thefield in Datasheet view says "Long Binary Data" then you DO NOT have
an OLE object embedded within the field. The field contains plain binary
data which can be anything. Hopefully, the field contains an exact copy of
the original file.

The simplest method is to save the fields contents to a temp file on your
hard drive with the proper Image type file extension(bmp etc.). Then simply
set the Picture property of the standard Image control to the name of this
temp file. Cleanup as required.


Create a form with an OLE Frame control, for this example named
"olePicture", bound to the field in question.


Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click


Dim a() As Byte
Dim lTemp As Long
Dim sl As String


lTemp = LenB(Me.olePicture.Value)
ReDim a(0 To lTemp -1)


' Copy the contents of the OLE field to our byte array
a = Me.olePicture.Value


sl = "OLEfieldTestImage" & ".BMP"
Open sl For Binary Access Write As #1
Put #1, , a
Close #1


Exit_cmdSave_Click:
Exit Sub


Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click


End Sub


You can also accomplish this without creating the temp disk file but it
involves a lot of API calls. There is code on my site to do just this
though.



--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top