472,985 Members | 3,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,985 software developers and data experts.

Display pictures on a continues sub form

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
3 5785
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ken | last post by:
I have a database called autographs.mdb that is in the "XYZ" folder in the "database" folder. I have a form in the database that I want to display a photo of the celeb on. The photos are in a...
3
by: RAllsopp | last post by:
I have a client who would like to have several pictures associated with one system. I have read about storing only the pathname to save OLE overhead and have set-up a form for my client to...
0
by: George Race | last post by:
I am trying to display pictures in either ReportViewer or Crystal Reports, using VB 2005. I have the path to pictures in a Form text box that is linked to the database containing the full path to...
3
by: saravanancse | last post by:
Can Any One Help Me....... How to display a Windows Form into Html page? I used Html Syntax <a href="that vb file name">file</a> But its shows only a coding,its doesn't show...
1
by: Maryanne | last post by:
1) How do I display in a form a string of 1:M relationships? (or does it need to resort to multiple forms?) * Starts with Client that has consultant and consultation desk. Client has many...
1
by: Larry Rebich | last post by:
Is there a way to display a web page then do something else - similar to the DoEvents in VB6? I have a rather long running process and I'd like to display the web form but during PageLoad I'd...
2
by: smorrison64 | last post by:
I have a form that is coded to open a File Dialog boc to pick a picture to display on that particular item on a subform. My form is not based on query, but rather two separate tables (one primary,...
3
by: =?Utf-8?B?a2FyaW0=?= | last post by:
Hello all, Is there a simple cod in vb 2008 to find a folder on a network and open a picture from that folder inside the form? thanks for any of your help.
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.