me.visible for labels and textboxes access

1.5k views Asked by At

I'm trying to toggle conditionally visibility of textboxes and labels using the me.visible = false statements. However, it doesn't seem to function properly in the on format event for my report footer.

I tried for onclick and onprint as well but none of them seems to work. Initially i tried the following code:

If Me.Text39 = "0" Then
    Me.Label40.Visible = False
Else
    Me.Label40.Visible = True
End If

As well as the following when i made the textbox empty and using a expression of ""

If isnull(me.text39) or isempty(me.text39) 

Finally i tried turning off the visibility without conditions

Me!Label40.Visible = False
Me.Label38.Visible = False

However that doesn't seem to work either. I also tried the nz(...,..) statements with 0, null, empty and etc as well... Does anyone know why?

Thank you!

1

There are 1 answers

0
Newd On BEST ANSWER

OnFormat doesn't ever seem to get called on a report footer. I tested this by doing the following:

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
        MsgBox "Reached Footer"
End Sub

And the message box was never displayed. Though since it is a footer I think you should be able to just put it into Report_Load() instead so something like this:

Private Sub Report_Load()
        Me.Label40.Visible = True
End Sub

I believe you should be able to put an If Check in there too.