From: Hugh self taught on 15 Feb 2010 16:55 Hi Access Gurus, I have a tabbed main form which has 2 subforms on one of the tabs where the subforms have been made to look like one form. My problem is that the user needs to be able to tab through the first subform into the next seemlessly but I can't get the setfocus syntax for that right in this setup. The Mainform is "MainMenu" the TabControl is "TabCtl0" the Page is "Addr" & the Subform is BusAddr. Can anyone help with the syntax? My intention is to place it in the Lostfocus Event of the last field on the first subform. Cheers for now
From: Marshall Barton on 15 Feb 2010 17:39 Hugh self taught wrote: >I have a tabbed main form which has 2 subforms on one of the tabs where the >subforms have been made to look like one form. My problem is that the user >needs to be able to tab through the first subform into the next seemlessly >but I can't get the setfocus syntax for that right in this setup. > >The Mainform is "MainMenu" the TabControl is "TabCtl0" the Page is "Addr" & >the Subform is BusAddr. Can anyone help with the syntax? My intention is to >place it in the Lostfocus Event of the last field on the first subform. Not clear which subform is which. Try this kind of code: With Parent.subformcontrol2 .Form.Recordset.MoveFirst .SetFocus .Form.firstcontrol.SetFocus End With Note that the tab control nor its pages have anything to do with it. -- Marsh MVP [MS Access]
From: John W. Vinson on 15 Feb 2010 18:11 On Mon, 15 Feb 2010 13:55:23 -0800, Hugh self taught <Hughselftaught(a)discussions.microsoft.com> wrote: >Hi Access Gurus, > >I have a tabbed main form which has 2 subforms on one of the tabs where the >subforms have been made to look like one form. My problem is that the user >needs to be able to tab through the first subform into the next seemlessly >but I can't get the setfocus syntax for that right in this setup. > >The Mainform is "MainMenu" the TabControl is "TabCtl0" the Page is "Addr" & >the Subform is BusAddr. Can anyone help with the syntax? My intention is to >place it in the Lostfocus Event of the last field on the first subform. > >Cheers for now The tab control is irrelevant: the syntax for referencing a subform is identical, regardless of whether there is a tab control involved or not. The simplest way is to add one more control in the first subform - you can make it a tiny textbox, and hide it behind some other control. Make it last in the Tab Index. In its GotFocus event (which will fire when the user tabs out of the previous control, but not when they mouseclick back to some other control to correct an error), use code like Parent!BusAddr.SetFocus Parent!BusAddr.Form!FirstControlOnSubform.Setfocus to set focus, first to the other subform, and then to the first control in that form's tab order. -- John W. Vinson [MVP]
From: Hugh self taught on 16 Feb 2010 02:38 Thanks John & Marshall, You've both been such a help time & time again. I didn't realize that I needed to break it down into 2 steps & couldn't understand why I couldn't move the focus. Many thanks "John W. Vinson" wrote: > On Mon, 15 Feb 2010 13:55:23 -0800, Hugh self taught > <Hughselftaught(a)discussions.microsoft.com> wrote: > > >Hi Access Gurus, > > > >I have a tabbed main form which has 2 subforms on one of the tabs where the > >subforms have been made to look like one form. My problem is that the user > >needs to be able to tab through the first subform into the next seemlessly > >but I can't get the setfocus syntax for that right in this setup. > > > >The Mainform is "MainMenu" the TabControl is "TabCtl0" the Page is "Addr" & > >the Subform is BusAddr. Can anyone help with the syntax? My intention is to > >place it in the Lostfocus Event of the last field on the first subform. > > > >Cheers for now > > The tab control is irrelevant: the syntax for referencing a subform is > identical, regardless of whether there is a tab control involved or not. > > The simplest way is to add one more control in the first subform - you can > make it a tiny textbox, and hide it behind some other control. Make it last in > the Tab Index. In its GotFocus event (which will fire when the user tabs out > of the previous control, but not when they mouseclick back to some other > control to correct an error), use code like > > Parent!BusAddr.SetFocus > Parent!BusAddr.Form!FirstControlOnSubform.Setfocus > > to set focus, first to the other subform, and then to the first control in > that form's tab order. > -- > > John W. Vinson [MVP] > . >
|
Pages: 1 Prev: Maintaining the aspect ratio for photos Next: Quit Database |