showing pictures in report (1 Viewer)

jmt90404

Registered User.
Local time
Today, 07:09
Joined
Mar 24, 2018
Messages
29
Please excuse my poor explanation as I'm still very new to Access and VBA.

I've created a report that is basically a to-do list with a number of tasks that the user needs to complete. one of the columns in the report is a priority field where on another form the user can change the priority of the task to either a 1, 2, or 3. I would like the report, instead of showing 1, 2, or 3 to show a specific picture assigned to each number. I was trying to accomplish this by using a combo box with the 2nd column having the link to the pictures but I can't figure it out. Any help will be greatly appreciated!
 

Mark_

Longboard on the internet
Local time
Today, 04:09
Joined
Sep 12, 2017
Messages
2,111
Are the images inside your database or elsewhere?

Easiest may be to have all three images on your report in the same location. Set their visible property to false. In the On Format event, check your priority and make the proper image visible. Something like

If Me.Priority = 1 then me.Image_1.visible = true
If Me.Priority = 2 then me.Image_2.visible = true
If Me.Priority = 3 then me.Image_3.visible = true
 

jmt90404

Registered User.
Local time
Today, 07:09
Joined
Mar 24, 2018
Messages
29
Currently the pictures are not in the database. I tried the suggestion but none of the pictures seem to appear. I put the code in the On Format event for the Detail section. What am I missing?
 

Mark_

Longboard on the internet
Local time
Today, 04:09
Joined
Sep 12, 2017
Messages
2,111
Please post your code so we can see what is happening. Also, put a msgbox in prior to doing any testing and have it tell you what your value is for priority. Remember, ACCESS will redo your source to match what fields/sorting/grouping you use in your report, so if you do not actually have priority on your report detail ACCESS may consider it null.
 

jmt90404

Registered User.
Local time
Today, 07:09
Joined
Mar 24, 2018
Messages
29
I do have the priority field in the detail section. One thing I neglected to mention is that I want the pictures to be visible when viewed on screen. I have noticed that with the below code the pictures are visible only during print preview only.

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.txtPriority = 1 Then
    Me.Image1.Visible = True
Else
    Me.Image1.Visible = False
End If
End Sub
 

jmt90404

Registered User.
Local time
Today, 07:09
Joined
Mar 24, 2018
Messages
29
Additionally, the report is in a navigation form. Not sure if that matters.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:09
Joined
May 7, 2009
Messages
19,169
Format event does not Fire on Report View.
 

jmt90404

Registered User.
Local time
Today, 07:09
Joined
Mar 24, 2018
Messages
29
Yes, I realize that now. Where should the code go?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:09
Joined
May 7, 2009
Messages
19,169
use a Form.
 

jmt90404

Registered User.
Local time
Today, 07:09
Joined
Mar 24, 2018
Messages
29
I don’t want to use a form as I am using grouping and sorting in the report. Is there no way to accomplish this task on a report?
 

isladogs

MVP / VIP
Local time
Today, 11:09
Joined
Jan 14, 2017
Messages
18,186
I don’t want to use a form as I am using grouping and sorting in the report. Is there no way to accomplish this task on a report?

Yes but use print preview instead of report view to view on screen.
 

jmt90404

Registered User.
Local time
Today, 07:09
Joined
Mar 24, 2018
Messages
29
I’d prefer not to have to use print preview. Is there no way to accomplish this on a report in report view?
 

isladogs

MVP / VIP
Local time
Today, 11:09
Joined
Jan 14, 2017
Messages
18,186
No. Images are not displayed in report view
 

Users who are viewing this thread

Top Bottom