473,396 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 5864
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.
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.