By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,206 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

Display pictures on a continues sub form

P: n/a
Ian
I have a form with a sub form, on the continues sub for I want to
display some data along with a picture, on the On Current event I have
the code:

[ImageFrame].Picture = Nz([ImagePath])

[ImageFrame] is the name of the picture control, [ImagePath] is the name
of the text field that holds the path to the jpg.

What I want is each record in the sub form to show the associated
picture, what I get is all records showing the first picture. I assume
this is because the On Current event only fires once and not once for
each record.

Any suggestions would be appreciated.
Dec 9 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ian wrote:
I have a form with a sub form, on the continues sub for I want to
display some data along with a picture, on the On Current event I have
the code:

[ImageFrame].Picture = Nz([ImagePath])

[ImageFrame] is the name of the picture control, [ImagePath] is the
name of the text field that holds the path to the jpg.

What I want is each record in the sub form to show the associated
picture, what I get is all records showing the first picture. I assume
this is because the On Current event only fires once and not once for
each record.

Any suggestions would be appreciated.
The only way to display an image per picture in a continous form is to use a
bound picture control and store the images in your database (really bad idea) or
to upgrade to Access 2007 as its ImageControl can do what you are attempting.

P.S. I think you'll find that your image will change as you navigate, but it
will still be the same image shown on all rows.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Dec 9 '07 #2

P: n/a
Rick,
I answered this for someone else asking the same question so I
apologize for the multiple post, but here's an easy solution:

What you're looking to do is very simple. I have done it in a number
of database builds, provided the images you wish to display are
relatively small and the total number of records you wish to display
is relatively small.
To give you an idea on the limits, I have built numerous forms that
do
this that display images that are 32 x 32 pixels where the total
number of records returned is in the hundreds (not thousands.)

Here's how you can do this very easily:
You'll do this with two tables. One is your existing table that
stores
data:
tblExistingData
DataID int (PK)
AnimalInfo varchar(50)
AnimalID int
This one will have data in it that looks like this:
1 This is my cow 4
2 This is my neighbor's dog 7
3 I rode this horse 5
4 I know this sheep 3
5 Some smelly pig 6
You need to create a new table that stores the images:
tblAnimalImages
AnimalID int (PK)
AnimalName varchar(10)
AnimalImage image
Into this table you copy and paste your icons into the appropriate
image column. The data will look like this:
1 Giraffe <giraffe icon>
2 Elephant <elephant icon>
3 Sheep <sheep icon>
4 Cow <cow icon>
5 Horse <horse icon>
6 Pig <pig icon>
7 Dog <dog icon>
8 Goat <goat icon>
9 Cat <cat icon>
Create your continuous form displaying the fields you want to show
and
include a bound image frame bound to AnimalImage
Create a query that links your two tables:
SELECT
d.DataID,
d.AnimalInfo,
i.AnimalImage
FROM
tblExistingData d
LEFT OUTER JOIN
tblAnimalImages i
ON d.AnimalID = i.AnimalID

On Dec 8, 7:00 pm, Ian <ian.sex...@ntlworld.comwrote:
I have a form with a sub form, on the continues sub for I want to
display some data along with a picture, on the On Current event I have
the code:

[ImageFrame].Picture = Nz([ImagePath])

[ImageFrame] is the name of the picture control, [ImagePath] is the name
of the text field that holds the path to the jpg.

What I want is each record in the sub form to show the associated
picture, what I get is all records showing the first picture. I assume
this is because the On Current event only fires once and not once for
each record.

Any suggestions would be appreciated.
Dec 9 '07 #3

P: n/a
Ian wrote:
>I have a form with a sub form, on the continues sub for I want to
display some data along with a picture...
What I want is each record in the sub form to show the associated
picture, what I get is all records showing the first picture. I assume
this is because the On Current event only fires once and not once for
each record.
Rick Brandt wrote:
The only way to display an image per picture in a continous form is to use a
bound picture control and store the images in your database (really bad idea) or
to upgrade to Access 2007 as its ImageControl can do what you are attempting.

P.S. I think you'll find that your image will change as you navigate, but it
will still be the same image shown on all rows.
And there is always another way to skin a cat...

As I mentioned in a similar post a few days ago you could create an
unbound form with the appropriate number of rows and columns of controls
and use code to control what they display.

You can make this appear like a continuous form but maintain complete
control of what is displayed. The drawback is that it requires a fair
amount of code to populate the controls, to control navigation through
all the records, etc.

You'll have to add your own navigation buttons and write code to handle
getting the next x rows, etc.
--
'--------------------------
' John Mishefske
' UtterAccess Editor
' 2007 Microsoft MVP
'--------------------------
Dec 12 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.