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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GotoPage

Status
Not open for further replies.

yont11

IS-IT--Management
Apr 13, 2006
19
AU
I am having trouble getting the GoToPage command to work. I have a single form with 3 tab controls. In an on exit event I want the focus to go from one tab control to another. I have used the code:

Forms!Switchboard.GotoPage 2

to move to the tab control I want but I keep getting the error:
Run-time error '2163'
The page number you used as an argument for the GotoPage action or method doesn't exist in this form.

Can anyone help? Thanks.

 
Do you have 3 TabControl or a TabControl with 3 tabs ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV it is a Tabcontrol with 3 tabs.
 
So, you may try something like this:
Me![TabControl name].Value = 1 ' GoTo Page 2

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV tried what you said with the following:

Me![Tabctl0].Value = 1 'Goto Page 2

it gave me a message Can't find the field 'Tabctl0' referred to in your expression.
 
And this ?
Forms!Switchboard!Tabctl0.Value = 1

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How are ya yont11 . . .

There's no [blue]focus events[/blue] for a tab control. You may have to add two buttons for left/right movement . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Thanks PHV & TheAceMan1 for your help. I'll keep working on it. Cheers.
 
If you have a control on your tabbed page that can receive focus, such as a textbox, simply place this code in the OnExit event you were speaking of:

YourTextBoxName.SetFocus


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Hi missingling,

Says it can't find the field. The field is sitting on another page. Thanks.
 
Says it can't find the field. The field is sitting on another page."

Sorry, but that makes no sense! If you set the focus to a control on the tabbed page the code will work! Did you try to set the focus to a field on a subform maybe? You have to reference controls on subforms differently.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Here's a cheat for the problem that I just gave someone yesterday. It work!

In Design View click on Page2 then place a textbox on it; name the control DummyTextBox. Place it in the left lower corner of your tabbed page. Now shrink it down the the absolute smallest size you can.

Then in the OnExit event of the last textbox on Page1:
Code:
Private Sub LastTextBoxOnPage1_Exit(Cancel As Integer)
  Me.[b]DummyTextBox[/b].SetFocus
End Sub

Good Luck!

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Thanks Missinglinq I will give it a try.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top