Iterate through tab pages

  • Thread starter Thread starter Question Boy
  • Start date Start date
If you're doing it to refer to controls you shouldn't need to... all the
controls are accessable from the main form detail regardless of what tab
they're on.
--
Jack Leach
www.tristatemachine.com

- "Success is the ability to go from one failure to another with no loss of
enthusiasm." - Sir Winston Churchill
 
No, I want to hide all the tabs but the first until the user enters/create a
valid record, then display them.
 
The vba to hide a particular page would be

Me.TabControlName.Pages(0).Visible = False

0 being the first tab, 1 being the second, etc.

You should be able to throw this in a loop to run through the index numbers
and hide the ones you need to.

--
Jack Leach
www.tristatemachine.com

- "Success is the ability to go from one failure to another with no loss of
enthusiasm." - Sir Winston Churchill
 
When I create a wizard, to walk a user through a process, I generally use a
tab control, set the style to None (so they cannot see or click on the
individual tabs), then put Next and Back buttons in the forms footer.

In the click event of those buttons, I either increase or decrease the value
of the tab control, and then disable the next button. Then in the
AfterUpdate event of those controls that are on each tab, I execute some code
to determine whether all of the required fields for that tab have been
entered. If so, I enable the Next button.
--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
you could use something like this:

for i = 1 to tabCtl.pages.count
if tablCtl.pages(i-1).name <> "main tab name" then
tablCtl.pages(i-1).visible = false
end if
next i

Where 'main tab name' is the nam of the tab you want displayed.
This assumes that you have the visible property to True for all tabs in the
form properties, which is the default.
 
glad to see all these suggestions helped...

Please follow ryguys advice and let us know so that other people don't waste
their time trying to do you a favor when you already have it figured out.

--
Jack Leach
www.tristatemachine.com

- "Success is the ability to go from one failure to another with no loss of
enthusiasm." - Sir Winston Churchill
 
Back
Top