View Full Version : Show/Hide Image on a Report


rmead
05-14-2007, 05:48 AM
Hi,

I have a field named 'Approved' which is a check box field - so a particular record can either be approved or unapproved. In my report that displays all the data for one particular record, I want to make visible an image given the condition that the field 'approved' is unchecked.

I am familiar with using the set property code / macros to accomplish this in a form, but I can not get it to work on a report. Any help would be appreciated.

Thanks!

GaryPanic
05-14-2007, 06:11 AM
on your report properties (in the detail section )
have this check box in it
then it will be
if Me!checkbox=true then fieldname.visible=true
if Me!checkbox=false then fieldname.visible=false

this should do it oh and an end if or two..
g

rmead
05-14-2007, 06:14 AM
I understand that that is the code that I want, the problem I am having is where to put it, exactly.

GaryPanic
05-14-2007, 06:16 AM
this is easy but hard to describe

on your report in design mode
get below the header where it states detail
now properties
code
that should do it

GaryPanic
05-14-2007, 06:16 AM
oops - no = build event

GaryPanic
05-14-2007, 06:18 AM
an old Access guy told me when in reports use ! instead of .

not too sure why - but I have been doing what yopu are trying to do and have been using ! everywhere - which works fine

Rich
05-14-2007, 06:19 AM
Me.MyImage.Visible = Me.Approved = False

rmead
05-14-2007, 06:36 AM
Got it now, thanks so much!

For some reason I was trying to make it happen on an event (I'm used to using macros for things instead of straight code), but once I figured out where to put it, everything worked as expected.

Again, thanks so much!

-Rob

boblarson
05-14-2007, 06:38 AM
Me.MyImage.Visible = Me.Approved = False
I don't think you can that syntax Rich (I've always run into trouble trying to use multiple = signs).

This should go in the On Format event of the detail section, or report (can't remember exactly where it's at and I currently don't have Access on the machine I sitting at, at work).

Me.YourImageControlName.Visible = Not Me!YourApprovalField


It uses "NOT" instead of just equals to, because you are wanting the image to appear if the checkbox is false, so the NOT operator changes the value to true for the display of the image.

GaryPanic
05-14-2007, 06:52 AM
rmead

which version worked??

I know mine does but did you try the others

g

Rich
05-14-2007, 09:48 AM
I don't think you can that syntax Rich (I've always run into trouble trying to use multiple = signs).


Yes although I've never had any probs with this
Me.OLEUnbound29.Visible = Me.Type = "Reminder"
Me.OLEUnbound31.Visible = Me.Type = "2ndReminder"
Me.OLEUnbound32.Visible = Me.Type = "Notice"
Me.OLEUnbound33.Visible = Me.Type = "Further Action"
Me.OLEUnbound34.Visible = Me.Type = "Statement"