Make label invisible

K

Kirk P.

I've got this code that runs when I open the Group Changes report. When
txtTermDate is null, it does make the text box invisible. But the label
still remains visible. What's the deal?


Private Sub Report_Open(Cancel As Integer)

If IsNull(Me!txtTermDate) Then
Me.txtTermDate.Visible = False
Me.lblTermDate.Visible = False

End If

End Sub
 
R

Rick Brandt

Kirk P. said:
I've got this code that runs when I open the Group Changes report. When
txtTermDate is null, it does make the text box invisible. But the label
still remains visible. What's the deal?


Private Sub Report_Open(Cancel As Integer)

If IsNull(Me!txtTermDate) Then
Me.txtTermDate.Visible = False
Me.lblTermDate.Visible = False

End If

End Sub

Is the label "attached" to the TextBox? If it is then its visibility should
stay synchronized with the TextBox.
 
D

Duane Hookom

The code should be in the On Format event of the section containing the
controls. You also need to add code to set Visible back to True when
txtTermDate is not null.

Me.txtTermDate.Visible = Not IsNull(Me.txtTermDate)
 
V

Van T. Dinh

In the Design View of the Report, select the Label by clicking on it. Do
you see a small black square appear on the top-left corner of any other
Control. If you do, the Label is attached to the other Control. If you
select the other Control, you will see a small black square on the top-left
corner of the Label.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top