Connecting Tech Pros Worldwide Forums | Help | Site Map

Linking Images using VBA code

chrisse_2@hotmail.com
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi,

All the records in my database will contain at least one picture. At
the moment all the images are part of the database as ole objects
although the database is way to big and there is only 12 records in it.

I have been reading about linking images into the database and i would
like to use the method linking via code this way the database will be
as small as possible.

Can someone help me do this as i am having trouble understand the
method.

Thanks in advance.

Christina


Supremefxdotcom
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Linking Images using VBA code


Have you thought about using the internet to interface with access?

This would make your life even more easier. But you can also do it by
simply just defining the full path of where the image located.

You will have to know VBA to get the image to show properly.

Hope this help.

PC Datasheet
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Linking Images using VBA code


1. Add a field named PicturePath (text data type) to your table. You need
to store the full path here to the picture for the record.
Ex:C:\MyApplication\MyPicture.jpg. Note that you need to include the
extension to make the path complete.
2. Be sure to include PicturePath in the recordsource of your form.
3. Add a hidden (Visible property set to No) textbox to your form and set
its controlsource to PicturePath. Also name the textbox "PicturePath".
4. Remove your bound object frame on the form and add an image control in
its place. Name it MyPicture. Note that an image control has a "Picture"
property. Go to the Help file and read how an image control works. Pay
particular attention to the Clip, Stretch and Fix size properties.
5. Add the following code to the Form's Current event:
Me!MyPicture.Picture = Me!PicturePath
Study this code so you understand what it is doing!!

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
resource@pcdatasheet.com
www.pcdatasheet.com


<chrisse_2@hotmail.com> wrote in message
news:1126661379.722614.181230@z14g2000cwz.googlegr oups.com...[color=blue]
> Hi,
>
> All the records in my database will contain at least one picture. At
> the moment all the images are part of the database as ole objects
> although the database is way to big and there is only 12 records in it.
>
> I have been reading about linking images into the database and i would
> like to use the method linking via code this way the database will be
> as small as possible.
>
> Can someone help me do this as i am having trouble understand the
> method.
>
> Thanks in advance.
>
> Christina
>[/color]


Larry Linson
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Linking Images using VBA code


<chrisse_2@hotmail.com> wrote
[color=blue]
> All the records in my database will
> contain at least one picture. At
> the moment all the images are part
> of the database as ole objects
> although the database is way to big
> and there is only 12 records in it.
>
> I have been reading about linking
> images into the database and i would
> like to use the method linking via code
> this way the database will be as small
> as possible.[/color]

The sample imaging databases at http://accdevel.tripod.com illustrate three
approaches to handling images in Access, and the download includes an
article discussing considerations in choosing an approach. Two of the
approaches do not use OLE Objects and, thus, avoid the database bloat, and
some other problems, associated with images in OLE Objects.

If you are printing the images in reports, to avoid memory leakage, you
should also see MVP Stephen Lebans' http://www.lebans.com/printfailures.htm.
PrintFailure.zip is an Access97 MDB containing a report that fails during
the Access formatting process prior to being spooled to the Printer Driver.
This MDB also contains code showing how to convert the contents of the Image
control to a Bitmap file prior to printing. This helps alleviate the "Out of
Memory" error that can popup when printing image intensive reports.

Larry Linson
Microsoft Access MVP


chrisse_2@hotmail.com
Guest
 
Posts: n/a
#5: Nov 13 '05

re: Linking Images using VBA code


Sorry it's been a while since you posted, although i'm still having
trouble getting this to work. The problem is the 'Picture' property. I
have to set it when i place the image control on the form and
regardless of which record i change to it only shows the one image.

Your help is greatly appreciated.

Christina

chrisse_2@hotmail.com
Guest
 
Posts: n/a
#6: Nov 13 '05

re: Linking Images using VBA code


Please ignore my last post. I have gotten this to work, just a silly
mistake!!!

Although i was also wondering, can i have a double click event on the
image so that when the user double clicks on it, it opens the real
image?

Closed Thread


Similar Microsoft Access / VBA bytes