Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Tab Captions on a Tab Control

Status
Not open for further replies.

osera

Technical User
May 15, 2006
35
US
Hello,

I have a form (cleverly named Form2) with a tab control (equally cleverly named tabctl29). The tab control has ten tabs, named TabA, TabB, etc.

When the form is opened, I'd like to have the captions on those tabs change to values looked up from a table. So, the form opens and program looks in table and sees that TabA should have the caption "First", for example.

Every code structure I've tried to use to reference the value of the tab captions has given me an error. I'm sure there has to be a way to do this, but I can't figure it out.

Thanks.
 
Me.TabCtl29.Pages(0).Caption = "First"
Me.TabCtl29.Pages(1).Caption = "Second"
...
me.tabCtl29.pages(9).caption = "Last
 
Have you tried this ?
Code:
Me!tabctl29.Pages("TabA").Name = "First"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
OOps, sorry for the TGML mess.
Code:
Me!tabctl29.Pages("TabA").Name = "First"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That did it. I was afraid it was going to be something like a '!' where I should have put a '.', and it was.

Many thanks!
 
both. You can refer to a page by its numerical index or its named index.
 
Well, I'd suggested the Name property instead of Caption ...
 
I used MajP's code because I was looking to change the caption, but it looks like either would work if I used:

Me!tabctl29.Pages("TabA").Caption= "First"

Either way, though, my thanks again to both of you for the quick response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top