0

Can't hide tabs on subform. I have a form with a tab control. I have a cmd btn with the following code:

Page16.Visible = False

This works great. I have several cmd buttons as a work around for multi row bug in tabs.

So, on this same form I have a subform with another tab control. I set up the a cmd button on the subform to hide those tabs. I used the same code as above swapping out the cmdpg and page number. The names are correct.

I've tried renaming the tabs and I tried using the pageindex as below:

TabListCollection.Pages(1).Visible = False 

However, no matter what I've tried, I get the following error.

The expression On Click you entered as the event property setting produced the following error:

  • The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
  • There may have been an error evaluating the function, event, or macro."

I'm not sure what is wrong?

Dennis
  • 33
  • 6

1 Answers1

0

The subform knows "itself", so try:

Me.Pages(1).Visible = False 
Gustav
  • 53,498
  • 7
  • 29
  • 55
  • 1
    That did not work either (same error message), although I did try this before. I feel something is corrupted/off. I created a new form and used the Page16.visible = False as above and it all worked perfectly. I'm not clear on what happened. – Dennis Mar 29 '23 at 19:06