Form

S

sebastico

Hello Community

I have a table with a students list and a form for the students table. I
also have the photo (.jpg) of each student. Any time I open the form I would
like to see the photo of each student. Could you tell me how can I do this?

The photos are in:C:\OGT\Students\photos

Many thanks in advance
 
F

fredg

Hello Community

I have a table with a students list and a form for the students table. I
also have the photo (.jpg) of each student. Any time I open the form I would
like to see the photo of each student. Could you tell me how can I do this?

The photos are in:C:\OGT\Students\photos

Many thanks in advance

I'll assume each student's picture is named "RecordID.jpg" where
RecordID is the students unique prime key field, . i.e. "15.jpg".

Note it's not a good idea to name the picture with the student's name,
i.e. "JosephSmith.jpg" as it is more than likely that, over time,
there can be more than one student with the same name. Using the
student's RecordID avoids name duplications.

Add an Image control to the form. You can enter ANY picture when
inserting the control onto the form. Save the form. Open the form in
design view and delete the Image control's Picture property. It should
read (none).

Include the [RecordID] field in the form.

Code the Form's Current Event:
Me!ImageName.Picture = "C:\OGT\Students\photos\" & Me.[RecordID] &
".jpg"
 
S

sebastico

Hi Fred.
Many thanks.

Yes I have identified each student's .jpg photo as you said. However, I
can't find the Image Control in the form. I'm using MS Access 2003.

Do I have to insert the code after giving double click in the left upper
corner of the form in design view?

Thanks again

fredg said:
Hello Community

I have a table with a students list and a form for the students table. I
also have the photo (.jpg) of each student. Any time I open the form I would
like to see the photo of each student. Could you tell me how can I do this?

The photos are in:C:\OGT\Students\photos

Many thanks in advance

I'll assume each student's picture is named "RecordID.jpg" where
RecordID is the students unique prime key field, . i.e. "15.jpg".

Note it's not a good idea to name the picture with the student's name,
i.e. "JosephSmith.jpg" as it is more than likely that, over time,
there can be more than one student with the same name. Using the
student's RecordID avoids name duplications.

Add an Image control to the form. You can enter ANY picture when
inserting the control onto the form. Save the form. Open the form in
design view and delete the Image control's Picture property. It should
read (none).

Include the [RecordID] field in the form.

Code the Form's Current Event:
Me!ImageName.Picture = "C:\OGT\Students\photos\" & Me.[RecordID] &
".jpg"
 
F

fredg

Hi Fred.
Many thanks.

Yes I have identified each student's .jpg photo as you said. However, I
can't find the Image Control in the form. I'm using MS Access 2003.

Do I have to insert the code after giving double click in the left upper
corner of the form in design view?

Thanks again

fredg said:
Hello Community

I have a table with a students list and a form for the students table. I
also have the photo (.jpg) of each student. Any time I open the form I would
like to see the photo of each student. Could you tell me how can I do this?

The photos are in:C:\OGT\Students\photos

Many thanks in advance

I'll assume each student's picture is named "RecordID.jpg" where
RecordID is the students unique prime key field, . i.e. "15.jpg".

Note it's not a good idea to name the picture with the student's name,
i.e. "JosephSmith.jpg" as it is more than likely that, over time,
there can be more than one student with the same name. Using the
student's RecordID avoids name duplications.

Add an Image control to the form. You can enter ANY picture when
inserting the control onto the form. Save the form. Open the form in
design view and delete the Image control's Picture property. It should
read (none).

Include the [RecordID] field in the form.

Code the Form's Current Event:
Me!ImageName.Picture = "C:\OGT\Students\photos\" & Me.[RecordID] &
".jpg"

In Form Design View, click on the Toolbox tool button. Find the Image
control in the toolbox and drag it onto your form. When prompted, you
will need to select a picture to get the Image control to 'stick'.
Select any picture. Save the form.
Open the form again in design view and delete the Image control's
Picture property. Then continue as in my previous post.

To place the code in the form's current event, right-click on the
corner where the top and left rulers meet to display the form's
property sheet. Click on the form's Event tab. Click on the current
event line and enter [Event Procedure].
Then click on the little button with 3 dots that appears on that line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code. Place the above code between these 2
lines. Change ImageName to whatever the name is of the Image control
you added to the form. Save the code.
 
S

sebastico

Thank you. I'ii try yor suggestion.


fredg said:
Hi Fred.
Many thanks.

Yes I have identified each student's .jpg photo as you said. However, I
can't find the Image Control in the form. I'm using MS Access 2003.

Do I have to insert the code after giving double click in the left upper
corner of the form in design view?

Thanks again

fredg said:
On Thu, 19 Feb 2009 10:27:01 -0800, sebastico wrote:

Hello Community

I have a table with a students list and a form for the students table. I
also have the photo (.jpg) of each student. Any time I open the form I would
like to see the photo of each student. Could you tell me how can I do this?

The photos are in:C:\OGT\Students\photos

Many thanks in advance

I'll assume each student's picture is named "RecordID.jpg" where
RecordID is the students unique prime key field, . i.e. "15.jpg".

Note it's not a good idea to name the picture with the student's name,
i.e. "JosephSmith.jpg" as it is more than likely that, over time,
there can be more than one student with the same name. Using the
student's RecordID avoids name duplications.

Add an Image control to the form. You can enter ANY picture when
inserting the control onto the form. Save the form. Open the form in
design view and delete the Image control's Picture property. It should
read (none).

Include the [RecordID] field in the form.

Code the Form's Current Event:
Me!ImageName.Picture = "C:\OGT\Students\photos\" & Me.[RecordID] &
".jpg"

In Form Design View, click on the Toolbox tool button. Find the Image
control in the toolbox and drag it onto your form. When prompted, you
will need to select a picture to get the Image control to 'stick'.
Select any picture. Save the form.
Open the form again in design view and delete the Image control's
Picture property. Then continue as in my previous post.

To place the code in the form's current event, right-click on the
corner where the top and left rulers meet to display the form's
property sheet. Click on the form's Event tab. Click on the current
event line and enter [Event Procedure].
Then click on the little button with 3 dots that appears on that line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code. Place the above code between these 2
lines. Change ImageName to whatever the name is of the Image control
you added to the form. Save the code.
 

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