MultiPage UserForm TextBox Event+Navigation Glitch

DixiePiper

New Member
Joined
Oct 19, 2015
Messages
41
Office Version
  1. 365
Platform
  1. Windows
I have a 4 page MultiPage control in a UserForm. On the 2nd page, I have a group of 2 option buttons followed by a series of TextBoxes in which I need to enter dates. To manage the TextBoxes, I have a separate UserForm, named CalendarForm, that serves as a date picker. After as much experimentation as I could manage, the only way I found to launch the CalendarForm was to use "Private Sub TextBox1_Enter()". That works fine for me. The issue I'm now having is with navigation. When entering the page, the CalendarForm launches. I need the CalendarForm restricted to interacting with the TextBox.

I'm using Excel 2013 in a Windows 10 environment. Here's the code snippets:

To launch the CalendarForm
Code:
Private Sub startBase_Enter()
    Dim dateVariable As Date
    
    dateVariable = CalendarForm.GetDate
    If dateVariable <> 0 Then startBase = dateVariable
    
End Sub
The above repeats for three additional TextBoxes. Disabling the startBase event fixes the problem so I know it's got something to do with this TextBox.

I have navigation buttons located in the UserForm for "Cancel", "Back", "Next", and "Finish". Shown is the code for the buttonNext; the code is similar for buttonBack
Code:
Private Sub NextButton_Click()
    MultiPage1.value = MultiPage1.value + 1
    
    Select Case MultiPage1.value
        Case 1
            optionConcurrent.SetFocus
        Case 2
            btnSelectAll.SetFocus
        Case 3
            CommandButton12.SetFocus
    End Select
    
    UpdateControls
End Sub
"Update Controls" refers to a separate process that enables/disables the navigation buttons based on the current page; it's irrelevant to this issue. The SetFocus works just fine. When entering Page2, either via the "Next" or "Back" buttons, the CalendarForm launches and I have to close it to continue. What am I missing?

Thank you in advance for any assistance.
 
Not sure what happened to my previous reply but ... I FIGURED IT OUT!

cerfani - thank you so very much for your time and effort. The mbEvents was definitely the way to go. What I needed was to also include it in the code for the "Back" and "Next" buttons. Now I can page forward and backward with NO pop up calendar and when I click the start.Base box, it pops up just like it should. I took your input, the article you posted, and just tinkered until I figured it out.
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top