Show or Hide label in Report

spectrum
StarLounger
Posts: 56
Joined: 24 Jan 2012, 21:48

Show or Hide label in Report

Post by spectrum »

I am trying to make a label in a report only visible if the textbox next to it has data.

The label is Updated - and the textbox to the right of it is called "UpdatedOn" and contains a date if data held, and the textbox to the right of that is called "Update" containing commenets if data held.

I was trying this but it does not work

Code: Select all

Private Sub GroupHeader3_Format(Cancel As Integer, FormatCount As Integer)
 If Me.UpdatedOn > "" Then
 Me.Updated.Visible = True
 Else
 Me.Updated.Visible = false
End If
End Sub
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78478
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Show or Hide label in Report

Post by HansV »

Try this:

Code: Select all

Private Sub GroupHeader3_Format(Cancel As Integer, FormatCount As Integer)
    Me.Updated.Visible = Not IsNull(Me.UpdatedOn)
End Sub
Best wishes,
Hans

spectrum
StarLounger
Posts: 56
Joined: 24 Jan 2012, 21:48

Re: Show or Hide label in Report

Post by spectrum »

Sorry Hans, no it still does not work. I even tried making Me.Updated hidden by default but no avail. I put a breakpoint in the code and it does not get ther? I presume my code is in the correct event? I don't know how I arrived in originally using Private Sub GroupHeader3_Format, as when I look in the events of report it's not mentioned as an event?

User avatar
HansV
Administrator
Posts: 78478
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Show or Hide label in Report

Post by HansV »

I assume that the name of the =[Progress]![Updated On] Header section in the Property Sheet is GroupHeader3.
If you click on that header, you should see [Event Procedure] in the On Format event in the Event tab of the Property Sheet, and clicking the builder dots ... in that event should take you to the code.
Best wishes,
Hans

spectrum
StarLounger
Posts: 56
Joined: 24 Jan 2012, 21:48

Re: Show or Hide label in Report

Post by spectrum »

Hans, I wish I knew as much as you do. I have not really got into the new report design builder. You were so on the ball, it's Group Header 2 !
I changed the event title to Group Header 2, put your code in, and hey presto works.
Thankyou very much again, I can goto bed now knowing its solved.

User avatar
HansV
Administrator
Posts: 78478
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Show or Hide label in Report

Post by HansV »

Great, have a good night.
Best wishes,
Hans