Select Case on a SubReport (1 Viewer)

Learn2010

Registered User.
Local time
Today, 12:37
Joined
Sep 15, 2010
Messages
415
I have a report named rptMRDDMonthly1. I am using Select Case to display images on it. The images are initials. The controls involved are days and number 1 to 31. If a day in the table has initials, the corresponding image will display on the report. In the example below, if Day1 is populated with the letters AM, then the image imgInitialsSmallAM1 will display on the report.

START of CODE
Select Case Day1
Case "AM"
imgInitialsSmallAM1.Visible = True
Case "AW"
imgInitialsSmallAW1.Visible = True
End Select

END Of CODE

This works well for all 31 days. I use this report as a subreport on a report named rptDailyLogMonthlyPrevious. I put rptMRDDMonthly1 in the report footer. When it opens, the images will not display. I might add that the Select Case statements are in the subreport. I tried them in the main report and had no success either. Do I need to reference the controls differently to make this work?

Thank you.
 
Last edited:

June7

AWF VIP
Local time
Today, 08:37
Joined
Mar 9, 2014
Messages
5,466
Are you using Image control or OLEObject control? Are this images embedded in a table Attachment or OLEObject field? How many Image/OLEObject controls are on this form? If the images are in a table Attachment field or external location with filepath/name stored in text field, can join that table to the data table and bind an Image control to that field by setting its ControlSource property. No VBA code needed.
 

Learn2010

Registered User.
Local time
Today, 12:37
Joined
Sep 15, 2010
Messages
415
I am using image control. They are on the report itself. There are 128 small images, .11 X .25, because there are that many options. I tried several ways to do this, but this was the only one that got the desired results. However, I will try your way.

Thank you.
 

moke123

AWF VIP
Local time
Today, 12:37
Joined
Jan 11, 2013
Messages
3,912
have you tried using fully qualified references such as me.Day1 or reports("MyReportName").image...
 

Learn2010

Registered User.
Local time
Today, 12:37
Joined
Sep 15, 2010
Messages
415
That's what I was looking for. I tried a few variations but did not include all the controls in identifying them on the subreport. I used the following code and it worked. Thanks for everybody's help.


START OF CODE

Select Case Reports!rptDAILYLOGMONTHLYPREVIOUS!rptMRDDMONTHLY1.Report!Day1
Case "AM"
Reports!rptDAILYLOGMONTHLYPREVIOUS!rptMRDDMONTHLY1.Report!imgInitialsSmallAM1.Visible = True
Case "AW"
Reports!rptDAILYLOGMONTHLYPREVIOUS!rptMRDDMONTHLY1.Report!imgInitialsSmallAW1.Visible = True
End Select

END OF CODE
 

Users who are viewing this thread

Top Bottom