Displaying Images on a Report (1 Viewer)

Learn2010

Registered User.
Local time
Today, 19:01
Joined
Sep 15, 2010
Messages
415
I have some procedures in place that generates a report with a subreport. I have a coaches table and I have a trainee table. After the coaches meet with the trainees they enter information into the database, which is a log. They enter a narrative, the date of the meeting, the start time, and the end time.

For each trainee I create two reports with the data. The Main report focuses on the narrative with the date and times. The second report is the subreport. It has 31 days in it in which it identifies the days the coach met with the trainee, the start time, and the end time of the meeting. There is a field for each day for the coach’s initials. That is, if they meet on a day, the coach’s initials will be in that day’s initials field.

Example:
Day
Day5

start time
9:40 AM

end time
10:00 AM

initials
CO

Here is what happens next. For every day (31 days) I have images on the report for each coach’s initials with the property Visible = False that will display in the appropriate box if the criteria is correct. Currently, there are two coaches. In the example above, the image for Coach Orwell will show up in the box for Day5. This works great! I am using Select Case in the OnLoad Event. For above it is:

Start of Code BU (I know this is not good formatting)

Select Case Reports!rptDAILYLOGMONTHLYCurrent!rptMRDDMONTHLY1.Report!Day5
Case "CO"
Reports!rptDAILYLOGMONTHLYCurrent!rptMRDDMONTHLY1.Report!imgInitialsSmallCO5.Visible = True
Case "AW"
Reports!rptDAILYLOGMONTHLYCurrent!rptMRDDMONTHLY1.Report!imgInitialsSmallAW5.Visible = True
End Select

End of Code

Now comes the problem. I can run a similar report for all the trainees using almost the exact code and get the exact same report with a record for each trainee, which displays as one page per trainee. On the first record the initials display correctly. The rest of the pages do not. Whatever displays for the first record displays for all of them. I have tried putting this in the OnLoad Event, OnCurrent, OnPage and none of it helps.

Start of Code BU (I know this is not good formatting)

Select Case Day5
Case "CO"
imgInitialsSmallCO5.Visible = True
Case "AW"
imgInitialsSmallAW5.Visible = True
End Select

End of Code

Does anybody have any suggestions as to why and are able to offer a solution. Also, where do I find how to display code properly in these posts?

Thank you.
 

Ranman256

Well-known member
Local time
Today, 19:01
Joined
Apr 9, 2015
Messages
4,339
if the image is unbound on a continuous record list, they will ALL be the same.

To get different images on different records (continuous or other) you must have the image stored in the db table as an OLE field. Then when the record shows anyplace, you get the image.
 

Learn2010

Registered User.
Local time
Today, 19:01
Joined
Sep 15, 2010
Messages
415
That makes all the sense in the world. I will try that and get back to you.
 

Learn2010

Registered User.
Local time
Today, 19:01
Joined
Sep 15, 2010
Messages
415
It's been a while but I am able to get back to this. I changed the data types to OLE Object for the images. I ran the procedure and all the images are in the table in the right places. When I open the report, the images still will not show. I have tried using the field as it is. I have used the bound frame, unbound, and everything else I could think of. Still no image.

I read some posts about needing Microsoft Photo Editor and downloaded one but nothing happened.

Any thoughts?
 

BeeJayEff

Registered User.
Local time
Today, 16:01
Joined
Sep 10, 2013
Messages
198
To get different images on different records (continuous or other) you must have the image stored in the db table as an OLE field. Then when the record shows anyplace, you get the image.
But images do not have to be stored within the database. I have a number of cases where a form has a subform control which typically displays data from three child records. Each child subform displays several images. Each of these image controls on the subform is of type "Image", whose control source points to the relevant jpeg file. This certainly applies to forms; I have not needed to generate any reports with similar characteristics.
 

isladogs

MVP / VIP
Local time
Today, 23:01
Joined
Jan 14, 2017
Messages
18,186
Adding to beejayeff's post, I do exactly the same thing in reports with multiple columns and .BMP files

For example to show up to 35 thumbnail photos per page for all students in a class.
As there can be several thousand photos, it would be a very bad idea to store these in the db. Instead the file path is used in the record source.

@beejayeff
I found that using jpg images gave poor quality results in Access due to their 'loss' nature. By comparison BMP, GIF, PNG gave much better results with similar file sizes. Does that match your experience?
 

BeeJayEff

Registered User.
Local time
Today, 16:01
Joined
Sep 10, 2013
Messages
198
@Ridders - I only display thumbnails within the Access subform. There is also a little "numeric keyboard" on the form with small buttons numbered 1 - 12 (maximum of 12 images per child record). Clicking on one of those buttons brings up the image in Corel Paintshop where it can be examined and/or manipulated as necessary. In the initial implementation, a double click on the image brought up Corel, but that caused much confusion if the current record was one other than the one the user clicked !

Edited to add : the image controls are typically about 1" square and will have originally been scanned at 500 dpi. More than adequate for recognition of the image.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 18:01
Joined
Feb 28, 2001
Messages
27,001
BeeJayEff - regarding issues with .JPG files...

The problem with image files is that the rendering software interacts differently for each file type. The .JPG file format is difficult to scale because it actually uses a polygon-fill method of storing an image. The .BMP polygon is always one pixel but the .JPG polygon might be pretty big, in the hundreds or even thousands of pixels. The typical "person's face against a solid-color background" might have large polygons encompassing the solid-color background. It is why .JPG compresses the size of a portrait-style image as compared to the same picture in .BMP format, but it is also why .JPG takes slightly longer to render. It is also why a .JPG photo of a very "busy" image with lots of fine detail might actually be LARGER than a .BMP of the same scene.

Stated another way, .BMP "scrapes" an image out of Windows memory wholesale and just "drops" that scraped image back into Windows memory when you display it. On the other hand, .JPG takes an image apart piecemeal and deconstructs it. Then reconstructs it when you display it. That is why JPG is sometimes "finicky."

Concur with Ridders and BeeJayEff that you should be able to just create an IMAGE control and load it's .Picture property with the name of the file you want displayed. As long as the path to the file is correct, that should do it. It did for me when I was organizing some family reunion pictures and vacation pictures.
 

Learn2010

Registered User.
Local time
Today, 19:01
Joined
Sep 15, 2010
Messages
415
Thank you all for your replies. I took all this into consideration and began experimenting. I was finally able to get the results I needed. First, let me say this. I already had the procedure set up using initials and signatures. I typed them into a text field in the Job Coach record in the backend database. They displayed on the report as a text field. this was easy.

My solution was to replace the initials and signatures text fields with Ole Object fields throughout the database. I then copied and pasted a bitmap image into the records in the backend database. That was two initials and two signatures. On the resulting report, I used a Bound Object Frame to display the images. This is working well.

Thanks for all your help.
 

Users who are viewing this thread

Top Bottom