When implementing an interface that uses tab controls, you may not want the user to be able to go to a specific page of that tab control before he is done entering data in another page.
Here is how to implement such a constraint:
1-When you create the tab control, select "Goto page" as the action in the Object properties dialog.
By selecting this action, you will just have to define the restriction that applies to the specific tab control page. All other page selection will be automatically managed by the tab control. To perform the test, we will be using a conditional statement that will redirect the user to a specific page if the entry condition is not respected.
2-In the form method, you need to address the case where the user clicks the tab control whose access is limited. In a tab control that has two pages, the following code organization could be used:
The example above makes sure the field "Field1" is not an empty string, before the user can access the second page of the tab control. If that condition is not respected when the user clicks the page 2, the tab control and the form page are set back to page 1.
Copy the following sample code into your database:
: (Form event=On Load )
: (Form event=On Clicked )
If ((MyTabControl=2) & (Field1=(""))) `When the user clicks page 2 and Field1 is an empty string
GOTO PAGE(1) `Going back to Page 1 of the form
MyTabControl:=1 `Forcing the tab control value