Forum

Set Focus to a Tab ...
 
Notifications
Clear all

Set Focus to a Tab on a MultiPages UserForm

3 Posts
2 Users
0 Reactions
125 Views
(@pamela-simpsonchickasaw-net)
Posts: 20
Eminent Member
Topic starter
 

I'm new to VBA and greatly appreciate the assistance provided on this site!

I have created a UserForm that contains a MultiPages section.  One of the fields on the "Orientation Info" tab is required upon save.  If the user isn't on the tab when they click the save button the error - "Run-time error '2110': Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus." appears.  I have tried setting the property I thought was the appropriate one to true, but that didn't work.  What I currently have in error checking is this:

'   Make sure a orientation dates are entered
    If ListBoxOrientationDates.Text = "" Then
        MsgBox "You must select orientation dates."
            ListBoxOrientationDates.SetFocus
        Exit Sub
    End If

What do I need to add to it to set the focus to "Orientation Info" tab and then that list box?

Again, thank you for your assistance!

 
Posted : 18/08/2016 9:59 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi,

Can you please supply a sample workbook with the form and code so we can have a look?

Regards

Phil

 
Posted : 18/08/2016 10:37 pm
(@pamela-simpsonchickasaw-net)
Posts: 20
Eminent Member
Topic starter
 

Hi Philip,

My example is attached.  I actually moved the orientation dates to the main part of the UserForm, so it is no longer an issue.  But now I've made department required in the code and it generates the same problem if the user has moved to the Gaming / Health tab.

On this same file, I am also wondering if there is a way to limit the Orientation Date drop down to show only the current week and then an additional eight weeks into the future?  I hate that the user has to scroll through so many weeks to get to what they are looking for.

Again, thank you very much for your assistance!

 
Posted : 20/08/2016 10:23 am
Share: