Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Label.Visible in Report

Status
Not open for further replies.

mjpearson

Technical User
Dec 13, 2002
196
US
I'm having a heck of a time with using the "visible" parameter.

I have a report band called "Include". It's based on a True/False field called [Include]. I'm trying to turn TEXT on/off based on this value. From what I've read, I think I need to modify the report footer band ("Include") and put in the following

OnFormat:

Code:
   = Iif( [Include]= true,
          me![Label1].visible = true,
          me![Label1].visible = false)

MS-Access doesn't like that. Any idea what I'm doing wrong?


mike
 
It looks like you have mixed code elements in an expression entered into a property.

You should try entering some code as an Event Procedure
Code:
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    me![Label1].visible = Me.[Include]
End Sub
This assumes Include is a bound control in the report footer.

Duane
Hook'D on Access
MS Access MVP
 
Thanks Duane,

Sorry but you lost me. I think you're suggesting that I can't use the "expression generator" to build the code? I tried what you sent and Access didn't like that either so back to the expression generator.

Maybe I'm using the wrong terminology. When I click on the band within the report it reports that is of type "Section: GroupFooter3". I was using the On-Format connection to activate the code.

As I understand it, the "me!" is a substitute for "GroupFooter3". And "Label1" is the name of the free standing label in the report contained within "GroupFooter3". So to reference the "visible" parameter, I need to use "me![Label1].visible=true|false".

Since I'm at the end of the grouping, I'm expecting the last "[Include]" field to still have a true/false condition. I just ran a test and it says that [Include] does in fact still exist and has a value that changes with the database (-1 and 0).

I saw your last reference to "binding" but I can't find any way to allow labels to be bound to anything. Do I need to use a text box instead of a label and bind it? Attempts to use text boxes also failed.

I'm still puzzled. Got any more clues?
 
I would expect the On Format property to look like:
[Event Procedure]
When you click the builder [...] button, you will enter the VBA code window where you would paste
Code:
    me![Label1].visible = Me.[Include]
You could also change the label to a text box with a control source like:
Code:
=IIf([Include]=True,"Your Caption Value",Null)

Duane
Hook'D on Access
MS Access MVP
 
Okay. I opened the event and inserted into the VBA subroutine. I tried to view the report I ended up in the debugger. It doesn't recognize the [Include] field. Very interesting. I wonder if Access doesn't know how to handle Yes/No fields???

mike
 
However, if I put the [Include] into a text box in the footer, it displaces values (-1 and 0). Very odd.
 
Those values are exactly what I would expect to see. True=checked=Yes=-1 and False=unchecked=0.

Did you try anything that I suggested since your post seems to have nothing to do with my suggestion.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top