Link to an image

  • Thread starter Thread starter AMH
  • Start date Start date
A

AMH

Hi there,

I have a table that has stored images. I want to link those images to
a form using a bound object frame, on update of a combo box (eg. If I
pick "1" from the combo box, I want the image for record 1 to display).
The table I'm pulling the images from is not the source table for the
form. I am trying to use the AfterUpdate() method to do this. Problem
is, the image isn't displaying! Here is my code:
____________________________________

Private Sub dg_class_AfterUpdate()

On Error Resume Next

Set dg_class_pic.Object = " SELECT dg_classes.image FROM dg_classes
" & _
" WHERE (dg_classes.class =
'Me!dg_class.value' ); "

End Sub
_________________________________________

Any ideas on where my code has gone wrong? Or is this attempt
impossible?

Appreciate any help, Thanks. AMH
 
The field [image] contains binary data, not an in-memory object; so trying
to assign this stream of bytes as an object achieve nothing. Trying to
control an OLEBound Field from VBA will probably be a very big challenge.

Even if it's part of another table, I don't understand why you don't include
this table in your select statement.

An alternative solution that I've used somewhere would be to set the Control
Source of the OLEBound field to a DLookup to the other table, something
like:

=DLookUp("[Logo]","[Organismes]","[IdOrganisme]=" &
[Forms]![f_Rp]![ComboIdOrganisme])

Hope this help. However, dealing with the OLEBound field to store/retrieve
images will be a lot of fun for you. If this is for a professional
utilisation, I would suggest using something (anything) else, like DBPix
from Ammara.
 
I included the table in my select statement, but where do I go from
there? The existing data doesn't display in the form anymore...

For clarification on what I'm trying to do:
I have all the images for various dangerous goods signs (eg.
explosives, radioactives, etc) in one table (called dg_classes) with
descriptions of what they mean and the "dangerous goods class" (ie.
class 1, explosives, <image>).

Now I need to assign a class to every substance in another table
(called raw_materials).

In the form representing the raw_materials table, i want to show the
sign for whichever class is assigned to a particular raw material,
hence it needs to be pulled from the dg_classes table...

Please let me know if it is still too difficult (considering my coding
skills are really bad!!).

Thanks again.
 
Not to worry! I rebuilt the form from scratch and it is working now.
Just need to refresh if something is updated, but I can handle that.

Thank you so much for your assistance.
 
Back
Top