Problem Hiding Field On Page Tab Selection

G

Guest

I have several pages included in my form. In the header part of the form, I
have a field that I want to hide if a certain page tab, named Reports, is
selected. It works but not the way I want it to. In the Reports page's On
Click control, I execute an event procedure that says:

Private Sub Reports_Click()
Me!FieldName.Visible = False
End Sub

However, the field is not hidden until I manually select anywhere down in
the body of the page with the mouse. I want it to hide the field immediately
when I select the page tab.

Any suggestions would be greatly appreciated. Thanks in advance.
 
A

Allen Browne

Use the Change event of the tab control instead of the Click event of the
page control.

This kind of thing:

Private Sub Tab1_Change()
Dim bHide As Boolean
bHide = (Me.Tab1.Value = Me.Page6.PageIndex)
If Me.FieldName.Visible = bHide Then
Me.FieldName.Visible = Not bHide
End If
End Sub
 

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