Linking Pictures

B

Bill

Hi All,

I have a form that shows a small picture of an object. When I
link to the image I check the 'link' box, thinking that it will do just
that. However my database file is growing rapidly and I have discovered that
the images are obviously embedded in the mdb file because they are still
visible when the file is loaded on a PC that does not have access to the
original linked images.

Can anyone tell me what I am doing wrong please? By the way this is on an
Access 2000 database.

Regards.
Bill.
 
R

=Ray=

You say you check the 'link' box... how are you getting to this checkbox?
I have a picture object which is linked as well, but the option to link or
embed it is in the properties window.

I am using Acess 2000 and I couldn't find a way to have a "picture field" at
all, so I just have a few lines of VBA code to update the picture, and I have
the path for the link entered in a field in the database.

Could you tell me how you put a picture field?
Ray
 
B

Bill

To start with I created a field in the table and set data type to 'OLE
Object'

Then from the toolbox I created a 'Bound Object' frame.

I set the control source of the bound object to the name of the field that I
created in the table.

When the form is run opened I right click on the bound object frame and
choose insert object.

I check the box create from file and the dialogue for browsing to the file
appears, including the link check box. I have to admit that it seems a bit
contrived so I might be doing it wrong, but it works!!

But as I said, pictures are being embedded NOT linked!!!


Regards.
Bill.
 
B

Bill

Sorry sabout the rushed typing - I should have stated explicitly in the 2nd
paragraph that the bound object frame is created in the form. Might confuse
some!!
 
R

=Ray=

The only thing I can think of is to set the OLE Type Allowed property to
"Linked" as an extra measure. Then the link checkbox will be checked and
disabled, but one wouldn't think that would actually give any different
result.

I'm really only a novice, though, so maybe someone else has a better answer.
Ray
 
P

phillip

Hi Ray, (and Bill):
Ole Object type controls in a table will always store the object within the
database. That the "Ole Type Allowed" be set to linked or embedded makes no
difference to the size of the storage.
If you are storing pictures the size of the database will also grow
considerably because Access stores them uncompressed as bitmaps, wether the
original file is a jpeg or not.
Another way to display pictures that are not stored within the database is
to use "Image" controls in a form. The Image control finds the picture in a
folder of your hard drive and displays it in the original format, for
instance ".jpg" . The picture is not stored in the database and therefore
it's size doesn't change at all.

Which control type to use, and wether you store or not, depends basically on
how you want to view the pictures... how you have to display them.
If you can view them one record at a time, with the form's "default view"
property set to "Single form", then you don't need an Ole Object type of
field in the table. You will need some field, either in that table or in
another one, with the ddress of the pictures in the folder in your hard
disk.
For instance in a products table you would have a text field that names the
picture for that product (say, "pic") Then you can either have a field for
the full address of the folder (say, "path") or refer to it in the form's
module window. you trigger the picture event with a command button or the
forms Current property, such as:

Private Sub Command36_Click()
Me!Image35.Picture = Me!ProdPath & [ProductsByCategorySfrm2].Form![Pic]
End Sub

' where the [Pic] is in a separate subform, in another table.
Or, if you don't have a path field and your pics are all in one place, then:
(This report is a catalogue with a several hundred pictures, none of them
bound and using an "image" field)

Private Sub GroupHeader5_Print(Cancel As Integer, PrintCount As Integer)
If Me!Pic = "Empty.jpg" Then
Me!pHOTO.Visible = False
Else: Me!pHOTO.Picture = "C:\MyDocuments\Products\Jpegs\" & Me!Pic
End If
End Sub

The "Empty.jpg", or blank picture, is necessary to display something when
there is no pic, or make the control invisible until a valid pic comes
along.

Now, the second option: If you want to view the pictures in continuous
forms, then you have to use Ole Object fields, bound object frame controls
and a big database. This is because Access will refer to the picture on the
record that has the focus (and you'll see lots of the same pic if you use an
unbound image control...) Bound Object Frame controls are the only way
Access can deal with different pics displayed per record in a continuous
form.
The good side of all this is that Access behaves quite nicely regardless of
the size of the data. Picture databases of over 3 Gb that work very light
and fast are quite common. I'm building one with 6800 pics that grew to 4.5
Gb so far and it's working like a charm!!

Hope this helps
 

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