Photographs on forms

kevmc

Registered User.
Local time
Today, 23:10
Joined
Jul 29, 2003
Messages
18
Let me start by saying, this is the first time I've posted a thread on the site, so I apologise for any mistakes. Also I only have a basic knowledge of Access so some patience may be required.

I have built a database which includes 3 tables, Employees, Courses Attended and Courses. I have created Forms which show employee details and courses they have attended. I would like to insert photographs of employees which change with each form opened. I have no knowledge of VB, any simple solutions would be great. Thanks for your help.
 
There is a sample Db here that helps you work with images in a form.
 
I looked at the sample database, but couldn't see how it worked. I need to know how to put the photographs onto a form so they will change as I move from one form to another. Don't forget I only have a basic knowledge of Access 2000.

Thanks for your help.

kevmc
 
Hi kevmc

I'll see if I can help a little bit. First of all it's not a good ideas to have images embedded within Access as it 'bloats' the image and the database will end up very large in no time.

It's much better to link the images. In your Employees table you will need a new field which will hold the filepath to the image. i.e. C:\MyDocuments\Photo1 etc

On the form with the employee details, add an image box. When you first add the image box to the form Access automatically opens to common dialog box and allows you to browse to an image to insert onto the form. Just click Cancel. On the properties of the image box under 'picture' type '(none)', this will remove any image.

You then need to link the image box with each photo. I've used the field name 'Location' to hold the filepath to the image in the Table.

On the Form_Current Event use the following code

If Not Me!Location = "" Or Not IsNull(Me!Location) Then
Me!ImageBoxName.Picture = Me!Location
Else
Me!ImageBoxName.Picture = ""
End If

This will automatically show the image for each employee.

HTH
Dave
 
Sorry about the delay in replying - I've been away.

The problem I'm having is, when I click cancel on the dialog box, the image box disappears too. Also if I insert a photo into the image box then type in 'none', I get a message 'can't open file 'none''.

As I said, I only have a basic knowledge of Access, so please excuse my ignorance.

Thanks for your help.

:confused:
 

Users who are viewing this thread

Back
Top Bottom