How to open specific page on a tab control

  • Thread starter Thread starter Sanjin Vidlanovic
  • Start date Start date
S

Sanjin Vidlanovic

Hello,



I have a form with a tab control on it. I would like to open that form in
different ways. From one place I want it to open with page 1 opened, and
from somewhere else with page 3 opened.



How can I do that? (I can open that form either by using macros or VB code)



Thanks, Sanjin
 
Sanjin Vidlanovic said:
Hello,



I have a form with a tab control on it. I would like to open that form in
different ways. From one place I want it to open with page 1 opened, and
from somewhere else with page 3 opened.
How can I do that? (I can open that form either by using macros or VB
code)

You could pass the desired page number in the OpenArgs argument of
DoCmd.OpenForm (it's the final optional argument). Then in the OpenEvent
of the form have code that reads the OpenArgs property and use that to set
the Value property of the TabControl.

Me.TabControlName.Value = Val(Me.OpenArgs)

The above uses Val() because OpenArgs is a string and the Value property of
a TabControl needs to be a number with zero being the index value of the
first page.
 
Back
Top