Image Control on Form Problem

O

OzPete

Hi all,

Access 2000 format but working with Access 2002, high end desktop PC, db sat
on server drive, with picture files (.jpg] in same directory.

I have a form with an image control [imagectl], a text box for the field
[photofile] and other related client stuff.

I successfully linked everything up with the methodology described in the
Northwind db. I even managed to enter all the picture file names and it all
looked very pretty. Pictures matched the clients, looked very swish....

However when I closed the database, and then went back in, no pictures
appeared. All was saved successfully, the correct event procedures
existed. no pictures!

So, I did it again, dropped on a new image control, linked it all up fine
and dandy, got the pictures displaying, saved everything, closed the
database, reopened it and hey presto! again no pictures.....

Any suggestions?

thanks in anticipation

OzPete
 
K

Kelvin

I'm guessing it has to do with way you are referring to the path of the
pictures. Are you specifying the full path or are you just assuming that
the images are relative to the current database? If you open a database by
double clicking from windows explorer, Access's default path is used so if
you are referring to a relative path, it won't find you pictures. If you
open the database from the actual open command dialod box, then the database
path is used. To get around this you should define the path of the current
database when setting the image.

Application.CurrentProject.Path will give you the path of the currently
opened database. So deifning the location of your pictures using this will
give you the corrent path regardless of which method you use to open the
database.

Kelvin
 
O

OzPete

Thanks Kelvin,

Just a little more info need tho mate, where do I define the path of the
current database
(the code would be fantastic....)

OzPete
 
K

Kelvin

I am guessing that you have code in the Current event of the form, something
like:

Me!imagectl.Picture = photofile

If all of your photos are in a directory called Photos that is a
subdirectory in the directory with the database then change the above line
to

Me!imagectl.Picture = Application.CurrentProject.Path & "\Photos\" &
photofile

This will use the full path to the photo when defining the image. This way
the filename will always be clearly defined.

Kelvin
 

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