papparuff at comcast.net
papparuff at comcast.net
Mon Jul 19 12:03:56 CDT 2004
John, You want to use the TabControl's Change event. Also, the cursor automatically moves to the first control on the tab selected. If you want it to go to a specific control on the tab then the following code will do it. Private Sub TabCtl0_Change() Select Case TabCtl0 Case 0 txtTab1LastControl.SetFocus MsgBox "This is page " & TabCtl0 Case 1 txtTab2SecondControl.SetFocus MsgBox "This is page " & TabCtl0 Case 2 txtTab3FourthControl.SetFocus MsgBox "This is page " & TabCtl0 End Select End Sub -- John V. Ruff The Eternal Optimist :-) Commit to the Lord whatever you do, and your plans will succeed. Proverbs 16:3 -------------- Original message -------------- > LOL. I think you misunderstood the question. > > When a tabbed form opens, the tab control tends to have the focus, usually > with the tab0 page of the tab control. > > I want to place the control into the first control on the selected tab that > can validly recieve the focus. This means: > > The control with the Lowest Tabindex that has TabStop = true that is Enabled > that is Visible. > > IF I used Sendkeys I could just send a tab key which would cause Access to > tab the cursor into the first valid control. > > Since I don't use Sendkeys, I need another way to do this. > > Somewhere in the guts of Access (page control) there is a collection of > items that may (or are) be in the tab order. Unfortunately it doesn't > appear to be exposed for us to use. > > I have built a pair of functions to find the first control that can receive > the focus. It involves iterating the collection of all controls, testing > each control to see if it has a TabStop property, then if it is enabled, > then if it is visible. If all these things are true, then this control MAY > be the first in the tab order. Now each such control is tested against > every other such control to find the one with the lowest TabIndex property. > > It works, and on my machine takes about 16ms to run on a fairly complex > form. > > It just seems that somewhere built in to Access I should be able to ask the > object with a controls collection which control in the collection is the > "first valid control in the tab order", i.e. which control can ACTUALLY > RECEIVE the focus using the tab key. > > JWC > > -----Original Message----- > From: Mike & Doris Manning [mailto:mikedorism at adelphia.net] > Sent: Monday, July 19, 2004 12:12 PM > To: 'Access Developers discussion and problem solving' > Subject: RE: [AccessD] moving focus off the tab page > > > FirstControl is the control you want to get the focus... > > Doris Manning > Database Administrator > Hargrove Inc. > www.hargroveinc.com > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Colby, John > Sent: Monday, July 19, 2004 11:02 AM > To: 'Access Developers discussion and problem solving' > Subject: RE: [AccessD] moving focus off the tab page > > > What is FirstControl a property or method of? > > JWC > > -----Original Message----- > From: Mike & Doris Manning [mailto:mikedorism at adelphia.net] > Sent: Monday, July 19, 2004 10:42 AM > To: 'Access Developers discussion and problem solving' > Subject: RE: [AccessD] moving focus off the tab page > > > Firstcontrol.SetFocus > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Colby, John > Sent: Monday, July 19, 2004 10:30 AM > To: 'Access Developers discussion and problem solving' > Subject: [AccessD] moving focus off the tab page > > > I need to force the focus off of the tab page into the first control in the > tab order. > > I do not use SendKeys. > > Is there a non SendKeys answer? > > John W. Colby > -- > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com