Going from Tab to Tab on a Form

jtvcs

Registered User.
Local time
Today, 11:51
Joined
Apr 10, 2003
Messages
97
Using this example works for going from Page 0 to Page 1, but when I use the same code to go from Page 1 to Page 2, etc. I get a run-time error 2163 : The page no you used as an argument doens't exist in the form. The actual form I'm using has a page index property which runs from 0 to 5 (6 tabs) and all tabs are visible. Any ideas ?

Code I used...
DoCmd.GoToPage 5
DoCmd.GoToControl "Facility"


Thanks for helping. JT
 
Rich, sorry not sure what you mean. Could you please expand upon your answer. Thanks, JT
 
Instead of DoCmd. GoTo use
Page1.SetFocus instead, if you put Me. in front of the page you'll soon find out if those page numbers actually exist
ie Me.Page4.SetFocus
 
Rich, guess your suspicions were right, using Me!Page2.SetFocus refturns an error 2465 'can't find the field 'Page2' referred to your expression. But I don't understand why. Like I mentioned earlier the Page Index property indicates there are Pages 0 to 5. Is that not the property it's referring to ?? Any ideas ?? Thanks, JT
 
Click on the relevant pages and look at the property sheet, their names will show there
 
You're the man ! Created a dummy tab control and saw the property was Page 1, Page 2, etc. In my Tab control I had given the pages names, Collection1, Collection2, etc. Just used the Collection2 in your Me!Collection2.SetFocus and it worked great. Thanks for hanging in there till we solved the issue. JT
 

Users who are viewing this thread

Back
Top Bottom