Shamil Salakhetdinov
shamil at smsconsulting.spb.ru
Sun Jul 27 21:26:10 CDT 2003
David, For the case of TabControl without subforms this code may help you: Public Function TabNameOfCtl(ByRef rfrm As Access.Form, ByVal vstrCtlName As String) As String Dim ectl As Access.Control Dim ectl1 As Access.Control Dim fFound As Boolean For Each ectl In rfrm.Controls If ectl.ControlType = acPage Then For Each ectl1 In ectl.Controls If ectl1.Name = vstrCtlName Then TabNameOfCtl = ectl.Name fFound = True Exit For End If Next ectl1 End If If fFound = True Then Exit For Next ectl End Function For the case of TabControl on subforms (nested tabs) more advanced code is needed... Shamil ----- Original Message ----- From: "David Emerson" <davide at dalyn.co.nz> To: <accessd at databaseadvisors.com>; <ACCESS-L at PEACH.EASE.LSOFT.COM> Sent: Monday, July 28, 2003 2:54 AM Subject: [AccessD] Determine current tab (x-posted) > I have a form with a tab control which has 3 tabs. The third tab has a > subform with a tab control on it and 2 tabs. The second tab of the subform > has another subform with a tab control having 4 tabs. > > On the main form I have a search box. Currently if this is used the focus > ends up with the first tab on the main form (it uses this field to search > on using DoCmd.FindRecord). My users want to be able to search but end up > with the focus on the particular tab they were in before the search. > > My problem is that I can't find a property that says what is the current > tab. I can find the current field but unless I know the tab I can't just > set the focus to that field. Any hints? > > Regards > > David Emerson > DALYN Software Ltd > 25b Cunliffe St, Johnsonville > Wellington, New Zealand > Ph/Fax (877) 456-1205 > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com