Default on tabs and pages

dsellers1

Registered User.
Local time
Today, 05:35
Joined
May 19, 2009
Messages
39
I have added a tab control to my form and currently have 3 pages in the following order: Transaction, Case, Customer. Is there a way to default to the "Case" page when I open the form without losing the page order?
 
Each page on a Tab Control has a Page Index property. It is a zero based index, so the first page is Page(0), the second is Page(1), etc. The value of the Tab Control itself is equal to the current Page index, so you can set the value of the Tab Control (and thus the Page) in the form's Open event. Example;

Code:
Private Sub Form_Open (Cancel s Integer)
 
    Me!YourTabControl = 1 'set tab control to the second page.
 
End Sub
 
Personally, since the pages potentially could end up with different index numbers, I would not set the value to the index but instead use the name:

Me.YourTabControlNameHere = Me.YourTabControlNameHere.Pages("Case").PageIndex

And that way, if you happened to add a page in between the first and second one it would still bring up Case as the default selected one.
 
I knew it had to be something more simple than what I was making it out to be. Thanks to all!
 

Users who are viewing this thread

Back
Top Bottom