Pictures in Access database records

D

Dustirhode

How do I show different pictures in individual Access database records (forms
view)?
 
M

Mark

You need to store the pictures in a separate folder from the database. Add a
field named PicturePath to your table and record the full path to the
picture for each record. Add an image control to your form. Be sure you have
PicturePath in the recordsource of your form. Put the following code in the
Current Event of the form:
Me!NameOfYourImageControl.Picture = Me!PicturePath.

Steve
 
T

Tanya

Hello Mark
I am trying to achieve the same objective, however I don't fully understand
your instructions.

Mark said:
You need to store the pictures in a separate folder from the database. DONE

Add a
field named PicturePath to your table DONE

and record the full path to the picture for each record. HOW DO YOU DO
THIS, WHAT DATA TYPE IS THIS?

Add an image control to your form I WILL CONTEMPLATE THIS MORE WHEN I
UNDERSTAND YOUR EARLIER INSTRUCTIONS.
.. Be sure you have
PicturePath in the recordsource of your form. Put the following code in the
Current Event of the form:
Me!NameOfYourImageControl.Picture = Me!PicturePath.

Thanking you in advance

Kind Regards
Tanya
 
F

Fred

Tanya,

Answering your one question, you can use a text field, and it's simply the
path and file name for the picture. e.g C:\PictureFolder\picture1.jpg

Fred
 
T

Tanya

Thanks Fred
I understand the part about the textbox and am able to create the default
path for the images, however I need to identify the correct image by matching
the STUDENTID field.

Also, Name of Image Control, do you mean when I insert an image control in
the document I simple rename it to something obvious like ImgControl? then in
the properties for this object place the event Me!ImgControl.Picture =
Me!PicturePath
I am guessing here also that Me!PicturePath refers to the field name and
does not need to be replaced with the actual path to the folder?

Regards
Tanya
 
R

Rob

See comments Below.

Steve


Tanya said:
Hello Mark
I am trying to achieve the same objective, however I don't fully
understand
your instructions.



Add a

and record the full path to the picture for each record. HOW DO YOU DO
THIS, WHAT DATA TYPE IS THIS?

As Fred responsed, the data type for PicturePath is text. Data stored in
PicturePath will look like: C:\PictureFolder\picture1.jpg

In other words, each record will identify a specific student by StudentID
and a specific picture will be associated with a specific student.
Add an image control to your form I WILL CONTEMPLATE THIS MORE WHEN I
UNDERSTAND YOUR EARLIER INSTRUCTIONS.

After you add the image control to your form, select the image control, open
Properties, go to the Other tab and in the Name property type in
StudentImageControl.
. Be sure you have

You will probably want to use a query for the recordsource of your form so
you can sort the students in your form alphabetically. Your student table
that contains the student's name and PicturePath needs to be included in the
query. PicturePath needs to be a field in your query. Add a textbox named
StudentPicture to your form, open Properties, go to the Format tab ans set
Visible to No.

Put the following code in the Current Event of the form:
Me!StudentImageControl.Picture = Me!StudentPicture
 
T

Tanya

Thank you all that have helped me with this problem.

My biggest difficulty with this was understanding what to do with the
ImgControl, a little further research on the internet and I have success at
last.

Thank you again to everyone, I really appreciate your input.

Kind Regards
Tanya
 
T

Tanya

Hi
My form is looking and working well, however I was wondering if it was
possible to change the option for viewing the image when the form is loaded,
rather than having to click on the form.
How would I go about this?
Thanks in advance.

Regards
Tanya
 
M

Mark

<< change the option for viewing the image when the form is loaded, rather
than having to click on the form.>>

Please explain what you mean by this statement.

Thanks!

Steve
 
T

Tanya

Hi Mark

I have set up my form with the text field 'picture' which contains the
default path and another textfield called picturepath which concatenates
[Picture]&[StudentID]&".jpg" and ImageControl is directed to PicturePath, and
this works wonderfully when activating the event code Me!ImageControl.Picture
= Me!PicturePath, however the event code is activated by mouse click and does
not update when the form is opened or a new record is selected.

Ideally, I would like to see the student image when focus is on a record or
perhaps a particular field and would like it updated with each record to
reflect a different student.

Kind Regards
Tanya
 
R

Rob

Hi Tanya,

Did you notice this instruction in my previous response:
Put the following code in the Current Event of the form:
Me!StudentImageControl.Picture = Me!StudentPicture

The Current Event fires when the form opens and each time your form goes to
a new record. Thus the image control will display the picture of the student
in the opening record and each time you change to a new student, the mage
control will display the new student.

Steve
 
T

Tanya

Thank you Rob, now I understand what you were talking about, I apologise, I
am not very experienced as you can see in working with events.

Kind Regards
Tanya

Rob said:
Hi Tanya,

Did you notice this instruction in my previous response:
Put the following code in the Current Event of the form:
Me!StudentImageControl.Picture = Me!StudentPicture

The Current Event fires when the form opens and each time your form goes to
a new record. Thus the image control will display the picture of the student
in the opening record and each time you change to a new student, the mage
control will display the new student.

Steve



Tanya said:
Hi Mark

I have set up my form with the text field 'picture' which contains the
default path and another textfield called picturepath which concatenates
[Picture]&[StudentID]&".jpg" and ImageControl is directed to PicturePath,
and
this works wonderfully when activating the event code
Me!ImageControl.Picture
= Me!PicturePath, however the event code is activated by mouse click and
does
not update when the form is opened or a new record is selected.

Ideally, I would like to see the student image when focus is on a record
or
perhaps a particular field and would like it updated with each record to
reflect a different student.

Kind Regards
Tanya
 

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