Show/Hide 2 Images on a report based on Yes /No field in query

DeltaD

New member
Local time
Today, 18:05
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:
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
 
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.
 
I would try
Code:
Me.Image1.Visible = Me.YesNoField

Just another way to do it?
 
see this demo to explain better.
view the report in Print Preview.
 

Attachments

Thanks everyone!
I'll give it shot when I get back to a computer and report back!
 
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

Back
Top Bottom