473,415 Members | 1,562 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,415 software developers and data experts.

How to display multiple pictures per record in an Access database?

I want to store and display (on a form or a report) multiple pictures
per
record in an access database. The pictures are not stored within the
database. They are stored as files and the database contains the paths
to the
pictures.
The database consists of two tables:

TABLE DATA
ID Name LastName

TABLE PICTURES
ID Path

I want to create a form displaying data for each record of TABLE DATA
and
all the pictures (let's say aligned horizontally) for the particular
record
from TABLE PICTURES (ID <-> ID). MS Access allows subforms to be added
to a
form, but this doesn't solve the case, since subforms can be only
displayed
in data sheet view.

Nov 13 '05 #1
12 20828
"Wadim Grasza" wrote
I want to store and display (on a form
or a report) multiple pictures per record
in an access database. The pictures are
not stored within the database. They are
stored as files and the database contains
the paths to the pictures.
The database consists of . . .
I want to create a form displaying data for
each record of TABLE DATA and
all the pictures (let's say aligned horizontally)
for the particular record from TABLE
PICTURES (ID <-> ID). MS Access allows subforms to be
added to a form, but this doesn't solve
the case, since subforms can be only
displayed in data sheet view.


Where in the world did you get the idea that they can ONLY be displayed in
datasheet view? The wizard creates that, by default, but you can certainly
set the Source Object of the Subform Control to a Form and display the data
in that Form within the Subform Control.

Unless you have a strict limit on the number of pictures, trying to align
them side by side could be problematical -- what happens when you have one
too many to fit on the line?

For reports, use a Query for Record Source, joining Table DATA and Table
PICTURES, use the Sorting and Grouping properties to create a Group on ID in
Table Data and each picture as a "detail line" in the Detail Section.

A Form/Subform with single record view of a Form in the Subform control
might work will for the Form where you enter / edit data.

Here's some additional information: The sample imaging databases at
http://accdevel.tripod.com illustrate three approaches to handling images in
Access, and the download includes an article discussing considerations in
choosing an approach. Two of the approaches do not use OLE Objects and,
thus, avoid the database bloat, and some other problems, associated with
images in OLE Objects.

If you are printing the images in reports, to avoid memory leakage, you
should also see MVP Stephen Lebans' http://www.lebans.com/printfailures.htm.
PrintFailure.zip is an Access97 MDB containing a report that fails during
the Access formatting process prior to being spooled to the Printer Driver.
This MDB also contains code showing how to convert the contents of the Image
control to a Bitmap file prior to printing. This helps alleviate the "Out of
Memory" error that can popup when printing image intensive reports.

Larry Linson
Microsoft Access MVP

Nov 13 '05 #2
Amazing, asking exactly the same question again with exactly the same
misinformation. It is NOT true that "subforms can only be displayed in
datasheet view". I'm not sure if it was here or in another newsgroup where I
answered your question. I suggest you visit http://groups.google.com, search
for the original posting, and review the answer there.

Larry Linson
Microsoft Access MVP

"Wadim Grasza" <Wa**********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I want to store and display (on a form or a report) multiple pictures
per
record in an access database. The pictures are not stored within the
database. They are stored as files and the database contains the paths
to the
pictures.
The database consists of two tables:

TABLE DATA
ID Name LastName

TABLE PICTURES
ID Path

I want to create a form displaying data for each record of TABLE DATA
and
all the pictures (let's say aligned horizontally) for the particular
record
from TABLE PICTURES (ID <-> ID). MS Access allows subforms to be added
to a
form, but this doesn't solve the case, since subforms can be only
displayed
in data sheet view.

Nov 13 '05 #3
I am absolutely sure that your amazement will be deemed after you learn
that this question was asked in multiple groups simultaneously.
Nevetheless, no-one seems to competent enough to solve another problem
that I have posted in the newsgroups, which is: how to display multiple
(the number may vary) images per record on an Access form or report
HORIZONTALLY.

If anyone knows the solution, please respond.

Nov 13 '05 #4
"Wadim Grasza" <Wa**********@gmail.com> wrote
I am absolutely sure that your amazement will be deemed after you learn
that this question was asked in multiple groups simultaneously.
Were you this rude in all of them?
Nevetheless, no-one seems to competent enough to solve another problem
that I have posted in the newsgroups, which is:
Either that or nobody was impressed by your approach
how to display multiple
(the number may vary) images per record on an Access form or report
HORIZONTALLY.

If anyone knows the solution, please respond.


I'm sure several people do.

Here's one way:

1. Create a form with the maximum hard coded image controls in the layout
you want.

2. Iterate through your fields in code and set the image's photo property
to the filed text (which I assume contains only a photo name)

While the following is not exactly as you want, the principle is the same -
24 image controls are laid out (actually on a 6-page tab control), and named
img1 through img24, and filled and made visible if a photo record exists.
In my case, I've already controlled for the max limit of 24 photos when I
created the records.

Dim c As Integer
Dim i As Integer
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

DoCmd.Echo False, "Fetching Photos"
c = 0
With rs
.Source = "SELECT photo_name FROM photo WHERE photo_off_id=" & id
.Open , CurrentProject.Connection, adOpenKeyset, adLockOptimistic,
adCmdText
Do While Not .EOF
If FileExists("C:\photos\" & .Fields(0)) Then
c = c + 1
Me("img" & c).Picture = "C:\photos\" & .Fields(0)
Me("img" & c).Visible = True
End If
.MoveNext
Loop
.Close
End With
DoCmd.Echo True

--
Darryl Kerkeslager

Power corrupts.
Absolute power corrupts absolutely.
Knowledge is power.
See www.adcritic.com/interactive/view.php?id=5927
Nov 13 '05 #5

"Wadim Grasza" <Wa**********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I am absolutely sure that your amazement will be deemed after you learn
that this question was asked in multiple groups simultaneously.


I am amazed that someone so incredibly self-assured would not have known
that multi-posting is incredibly irritating to people who provide answers,
and that cross-posting (that is, listing all the newsgroups in the same
post) will result in followups (answers and additional dialog) will appear
in all the newsgroups, so that the threads will not diverge. For other good
suggestions on effective use of newsgroups, see the FAQ for this newsgroup
at http://www.mvps.org/access/netiquette.htm.

Frankly, at this point, I am not sufficiently motivated to give you an
additional answer to go and google to see all the exchanges in those
multiposted newsgroups. If you'd care to carefully review your question, the
answers, and clarifications you have made and start a new thread, perhaps
someone will have an answer for you.

You significantly decrease your chances of getting the answer you need when
you make it difficult for the potential responders and when you respond
defensively to irritate them.

Larry Linson
Nov 13 '05 #6
Thanks for your help.

I'm still looking for a solution because this one creates a limited
number of image controls. My objective is to have the number of image
controls not limited.

Thanks again.

Nov 13 '05 #7
To respond to your message: I appreciate your advice. This message has
been sent to one group only so there will be no 'exchanges'.

After reviewing my question, the answers, and clarifications the
following should clarify my problem lastly: How to horizontally display
multiple (number not limited) images per record on a form or a report?

Nov 13 '05 #8
"Wadim Grasza" <Wa**********@gmail.com> wrote
I'm still looking for a solution because this one creates a limited
number of image controls. My objective is to have the number of image
controls not limited.


I suppose you could count the images to be created, open the form in design
view, dynamically create the image controls, then proceed ... but what a
pain in the butt for users to use a form that would scroll horizontally
forever.

--
Darryl Kerkeslager

Power corrupts.
Absolute power corrupts absolutely.
Knowledge is power.
See www.adcritic.com/interactive/view.php?id=5927
Nov 13 '05 #9
This might be a good solution. But please notice that the image
controls have to be created on the OnCurrent event, because the number
of images and the images themself differs depending on a record. I
don't know if it's possible to switch to Design mode, while on the
current record, create some controls, and then go back to Form View
mode. And event if it's possible, is it optimal? I wish controls could
be created in Form View mode.

Anyway, thanks for the suggestion.

Nov 13 '05 #10

"Wadim Grasza" <Wa**********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
To respond to your message: I appreciate your advice. This message has
been sent to one group only so there will be no 'exchanges'.

After reviewing my question, the answers, and clarifications the
following should clarify my problem lastly: How to horizontally display
multiple (number not limited) images per record on a form or a report?


What determines the number and which images. If you will describe the
Record, someone might be able to help. If the path-and-filename of the
images are held in a related Table, one per Record, you can do what you
want; if the image-path-and-filename are held in multiple text fields in the
same Record, you can do what you want (but that would imply a limit). You
will have to know the maximum number of images so you can preset Image
Controls -- fill the Picture property of the ones you want to display; set
the Visible property of the others to False.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #11
Thanks for your help.

The dataset contains two tables: T_PEOPLE and T_PICTURES.
T_PEOPLE has the following columns: ID, Name.
T_PICTURES has the follwing columns: ID, PersonID, Path.

The database contains a form named F_PEOPLE. The datasource of the form
is T_PEOPLE table.

I want the F_PEOPLE form to dislpay all the pictures from the query:
SELECT * FROM T_PEOPLE INNER JOIN T_PICTURES ON CurrentID =
T_PICTURES.PersonID, where CurrentID is the ID of the current record on
the form.
I would like to display the images horizontally. I would also like to
have the number of displayed images not limited.

Naturally, the number of images should be constrained at some point,
but I feel that it's more elegant if it is not constrained at this
point. I would like to have the possibility to display unlimited number
of images. I have a rather foggy idea on MS Access architecture, but,
as a programmer, I think that if not being able to create controls in
Form View mode is for a reason, there are other ways to achieve the
aimed goal (limiting recursive calls or security or the general idea
etc.), othen than keeping programmers off creating controls in Form
View mode. Since I'm still a student, my knowledge and reasoning might
not be as deep and thorough as they should be in order to understand
the grounds of the restriction. However, I would like to know these
grounds. And I would also like to see a way to achieve my goal.

Thanks for your response,

Wadim Grasza

Nov 13 '05 #12
Correction: I want the F_PEOPLE form to dislpay all P pictures from the
T_PICTURES that satisfy the following condition: P.PersonID =
currentID, where currentID is the ID of the current record in F_PEOPLE
form.

Nov 13 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chumley the Walrus | last post by:
IN my code behind .vb page for a delete records script (this also does a deletion confirmation with a javascript popup, this gets called on my front .aspx page with the datagrid), I'm not sure if...
9
by: Wally | last post by:
I am trying to display images from an Access 2000 database and I get an error "Invalid Parameter Used" when I execute the code line "picBLOB.Image = Image.FromStream(stmBLOBData)" in my Visual...
3
by: Pedro Maria Ferro da Cunha | last post by:
I spend a lot of time making 2 thousand pictures and saving them as an article name. jpg. I have a table with the article name and name of the file in jpg (format). How can I make an...
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: Ian | last post by:
I have an Access 2000 database in which I display many pictures on reports, the pictures are not embedded, the database just stores the path to where the pictures are stored. When I select Gifs,...
1
by: Ian | last post by:
I have an Access 2000 database in which I display many pictures on reports, the pictures are not embedded, the database just stores the path to where the pictures are stored. When I select Gifs,...
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: Ian | last post by:
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: .Picture = Nz() is the name of the picture...
46
by: OldBirdman | last post by:
What a mess this question is. I have spent 2 weeks trying to make it concise and clear, and I can't. I do not have the vocabulary for the question. I cannot even TITLE it correctly. Here is my...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.