Solved SetFocus

RevJeff

Registered User.
Local time
Today, 18:12
Joined
Sep 18, 2002
Messages
129
Hi, I have a form with a Tab Control on it. I have 3 tabs on the Tab Control and I am trying to SetFocus to a specific Button on each Tab when I click those tabs, but it doesn't work. It's acting like every time I click those tabs it chooses a different focus on that tab.

I hope I explained that clearly. Any thoughts?

Thanks!
 
Hi. Can you please show us the code you're trying to use?
 
What code are you using and in what event?
You probably need to use the TabChange event, and also work out which tab you are on.

Also, check the tab order on the tab control, that might fix things for you.
 
I don't really have much code. I tried this on the On Click for the specific tab, which only works if you click on the body of the Tab, not the actual Tab at the top. I then set the Tab Order of the button on the Tab and that still didn't work.

Code:
Private Sub REPO_Click()

    Me.btnSelectFileREPO.SetFocus

End Sub
 

Attachments

  • Capture.PNG
    Capture.PNG
    5.3 KB · Views: 406
Like I said - with a Tab control you need the On Change event of the tab control, and you will need to know which tab page you have selected.
Tab controls aren't the most intuitive to work with Use something like

Debug.print Me.MyTabControl

To tell you which page you are on.
 
Like I said - with a Tab control you need the On Change event of the tab control, and you will need to know which tab page you have selected.
Tab controls aren't the most intuitive to work with Use something like

Debug.print Me.MyTabControl

To tell you which page you are on.
That worked perfectly! Thank you!
 
Or, actually change the page. Me.TabControlName.Value=2 (then, set focus to a button on that tab)
 

Users who are viewing this thread

Back
Top Bottom