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

how to check which tab is active?

Status
Not open for further replies.

kronar30

Programmer
Sep 8, 2004
74
0
0
US
I have a project written in Access 97 converted to Access 2010. I am hitting an error because a set focus command is trying to set focus to a field in a prior tab. How can I test which tab is active? tabOverhead.SetFocus had changed the active tab to the Overhead tab, but code tries to set focus to a tabSummary field. Can't find where this code is trigered once focus changes to Overhead tab, so was going to check that this is only performed when the tabSummary tab is active.
 
You can get the active control and it's parent which I would expect to be the page in the tab control so something like:


Code:
Debug.print Me.ActiveControl.parent.name

Even if that is not exactly right hopefully it puts you on the right track.
 
If you truly want to only "set focus to a field in a prior tab" you don't have to worry about tabs. Simple code like the following should work:

Code:
Private Sub Command15_Click()
    Me.[highlight #FCE94F]XXXX[/highlight].SetFocus
End Sub

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top