Show/Hide 2 Images on a report based on Yes /No field in query (1 Viewer)

DeltaD

New member
Local time
Yesterday, 21:25
Joined
Apr 11, 2021
Messages
12
Hi guys!
I've been beating my head against this one for a while.
I've got a query with a report attached to it to generate signs for my workplace. How would I go about showing or hiding 2 caution signs based on a yes / no checkbox? Is there VBA code for this?

The table underneath has a Yes/No field dedicated to this, and I'd love to have it appear / disappear on a "per record" basis

I can post a sample database if needed
Thanks!
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:25
Joined
May 7, 2009
Messages
19,242
you can't do that when in Report View of your report?
you need to be in the Print Preview.
you also need to add the YesNoField to the report (if you must hide it
set it's Visible property to No).

add code to the Detail Section (of report) On Format Event:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me!YesNoField Then
    Me!Image1.Visible = True
    Me!Image2.Visible = True
Else
    Me!Image1.Visible = False
    Me!Image2.Visible = False
End If
End Sub
 

DeltaD

New member
Local time
Yesterday, 21:25
Joined
Apr 11, 2021
Messages
12
I have not tried the on format event!
When I added the code as a module before, the text fields would throw a #Type error back.
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:25
Joined
Sep 21, 2011
Messages
14,299
I would try
Code:
Me.Image1.Visible = Me.YesNoField

Just another way to do it?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:25
Joined
May 7, 2009
Messages
19,242
see this demo to explain better.
view the report in Print Preview.
 

Attachments

  • reportSign.accdb
    1.7 MB · Views: 167

DeltaD

New member
Local time
Yesterday, 21:25
Joined
Apr 11, 2021
Messages
12
Thanks everyone!
I'll give it shot when I get back to a computer and report back!
 

DeltaD

New member
Local time
Yesterday, 21:25
Joined
Apr 11, 2021
Messages
12
see this demo to explain better.
view the report in Print Preview.
That solution worked perfectly! Now all i need to do is figure out how to stop every other report item from being light grey

Thanks @arnelgp!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:25
Joined
May 7, 2009
Messages
19,242
rom being light grey
perhaps you are talking about the Alternate Color of the Detail section of the report?
go in design view. Click on the Detail Band of the report on its property, set the Alternating Color to No Color.
 

Users who are viewing this thread

Top Bottom