How to hide a control on a different tab [page] of a form?

J

Jimbo213

I have a multi-page form [looks like tabs].
FieldA shows on Page1 and Page2 of the form

When I check FieldB, I want FieldA to be hidden
1) on the current Page1
2) on Page2

This code works 1) on the current page because Me! means Page1:

Private Sub FieldB__AfterUpdate()
‘
If Not Me![FieldZ] = 0 Then
Me![FieldA].Visible = True
Else
Me![FieldB].Visible = False
End If
'
End Sub

What do I have to add to the code to change Page2's FieldA visible property?
 
S

Steve Schapel

Jimbo,

No, Me! does not mean Page1, Me! refers to the form. So I am a bit
confused about what you mean. My guess is that you have two controls
(textboxes or whatever), both bound to the same field (FieldA). Would
that be right? If so, what are the names of the controls?

By the way, your code is unnecessarily complicated. Try like this

Private Sub FieldB__AfterUpdate()
Me.FieldA.Visible = Not Me.FieldB
End Sub
 
J

Jimbo213

Yes I have two text boxes tied to FieldA.

Since you asked for the exact field names, here is the actual code that
works on page1 named "Testing"

Private Sub TestIn___Functional_Integration__AfterUpdate()
If Not Me![TestIn - FunctionalIntegration] = 0 Then
Me![TestIn - Iteration].Visible = True
Else
Me![TestIn - Iteration].Visible = False
End If
End Sub

How can I also hide a 2nd text box on page2 "Environment"
 
J

Jimbo213

Got it ...

Me.[TestIn - Iteration].Visible = Me.[TestIn - FunctionalIntegration]
Me.[Text393].Visible = Me.[TestIn - FunctionalIntegration]

thanks for steering me in the right direction
 

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