Photo within Forms

G

Guest

I have created an Access form from my client database, and have learnt how to
place a photo/graphic on the form. Is there some way to place a photo tag on
the form so that whenever I access a particulat client their photo will
appear on the form? Foe instance, when I do a search tor "John Doe" within
the form, I would like for a photo of "John Doe" to appear within the form.

Please advise.

Thank you.
 
G

Guest

I can't be of much help, as I am wanting to find out how to do this also.
However, I can tell you that this is done in the sample database NorthWind
that comes with Access. Look on the form named Employees.

I am too new to Access to figure out exactly how it is done, but there is a
text field that simply contains the name of the image file. On the form is
some sort of control that uses the file name to display the image.

If you figure it out let me know!
 
M

MacDermott

There are several different ways of accomplishing this.
The technique used in the Northwind database is the simplest, but it also
works best with only a few records.
I'd suggest you try this:
1. Compact/Repair your database. Note the size of the mdb file in Windows
Explorer.
2. Add a Pic field to your Employees table; set its Data Type to OLE.
3. Choose a picture file in Windows Explorer, copy and paste it into one
record of your table. Now note the size of the mdb file in Windows.
4. Compact/Repair the database, and note the size one more time.

You can see that Access uses a LOT of room to insert a picture into a file,
and keeps a good deal of it even after a compact/repair. The increase in
size of the mdb is many times the size of the picture in Windows. Think
about how many pictures you want to reference in this application, do the
math, and decide whether you want to use up that much space.
If you have only a few dozen employees, this technique may work fine for
you. If you want to get into more advanced methods, Google in newsgroups
like this for ideas, and post back if you have specific questions.
 
G

Guest

Thank you for your reply. However, the technique used in the Northwind
database does not use embedded OLE objects. Instead, only the name of the
image file is saved in the database. The form has the responsibility of
retrieving and displaying the pictures.

The problem is I know too little about forms at this point to figure out how
to replicate this behavior. I would REALLY appreciate it of you would tell
me how, or point me to a URL that explains how.

Thanks
 
M

MacDermott

I just looked at Northwind for Access 2003 - I still do most of my Access
work in Access 2000.
Yes, the technique has changed; in older versions, it worked as I had
described in my previous post.
And while the older technique had the limitations I mentioned, it did have
the advantage of simplicity.

To follow (or reproduce) the technique used in the 2003 version of
Northwind, you'll have to use some VBA code.
The heart of the matter is on Line 37 of the Employee form's module; the
rest of that procedure is about dealing with cases where you don't have a
full path entered.

For simplicity, you can do this:
Make sure you have a Text field in your table, with a full path to an
existing picture file for each record. Let's call it ImagePath.
Now put an (unbound) Image Frame on your form, and name it ImageFrame.
Also put a bound textbox on your form; you can set both its name and its
ControlSource to "ImagePath".
Put this code in your Form_Current event procedure:
ImageFrame.Picture=ImagePath

You should now be able to move through the records in your form, and see a
picture for each one.
If you want to change the picture, edit the textbox, move to a different
record, then when you come back to this one, you should see the new picture.
Remember, this is just for starters, a simple way to start building this
technique.

Once you get this going, you may be able to study some more of the code and
figure out how to refine this model. If you have specific questions, do
post back. Remember to tell us:
What is it doing that you don't want?
What isn't it doing that you do want?

HTH
 
S

Stephen Lebans

There are only two controls on the ToolBox that have the word "frame" in
them, the Unbound Object Frame and Bound Object Frame. I know you mean
for the OP to use the Image control but your use of the term
"ImageFrame" may mislead the OP to select one of the OLE Frame controls
instead of the plain Image control.

Just my $.02
--

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

MacDermott

Thanks for that clarification, Stephen.
I had confused the name of the control "ImageFrame" with its type, which
is indeed "Image". Glad your mind was sharper than mine!
 

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