+ Reply to Thread
Results 1 to 10 of 10

Multipage Control - Page Contents not changing with coded page change

  1. #1
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Multipage Control - Page Contents not changing with coded page change

    I have a multipage control in my userform (uf9_poststaff). It has three pages. The first page, the main page, holds a value of 0. This main page is the default page that the user is returned to after they complete some processes on a second opened userform (uf9c_cancel). The "CANCEL" button on userform uf9c_cancel closes that userform and returns the user to the default (first) page of the multipage control of userform uf9_poststaff.

    Here is the code ...
    Please Login or Register  to view this content.
    What I am experiencing isn't what I was hoping. The focus does change from the other pages to page 0 (the main default page), but that page's contents remain from the previous page. So the tab highligh changes, but the contents do not match that of that page. That page (page 0) continues to host the contents of either page 1 or 2, whatever it was last on. Should it be triggering the multipage change event? If so, it isn't. I use mbevents = true / false to suppress control triggers when initializing userforms. At this point in my code, mbevents = false, but even if in trial, I include the line mbevents = true before the coded multipage change to 0, I still get the wrong result.

    Where have I gone wrong? Thoughts? Solutions?
    Last edited by Jenn68; 03-08-2018 at 12:22 PM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    2016 Win10
    Posts
    6,680

    Re: Multipage Control - Page Contents not changing with coded page change

    I can't replicate that behaviour. I think we need to see your workbook.

    You haven't inadvertently used a tab strip have you and named it as a multipage?
    Last edited by Kyle123; 03-08-2018 at 01:09 PM.

  3. #3
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: Multipage Control - Page Contents not changing with coded page change

    Hi Kyle! Thanks for acknowledging my issue.

    I checked to make sure, and it is indeed a multipage. I do have a multipage change event that functions properly when I manually changes pages. I just can't seem to get the result from coded page changes? I would have thought that coding a page change would trigger that event. Should it? I get the same behaviour if I code different page numbers.

    I don't think sharing my workbook would be an option. It's a couple thousand lines long, requires access to network files, and contains sensitive information. I wish I could but it wouldn't be practical I'm afraid. If there is any behaviour that might need explanation or additional pieces of code, I can certianly offer up that.
    Last edited by Jenn68; 03-08-2018 at 01:41 PM.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    2016 Win10
    Posts
    6,680

    Re: Multipage Control - Page Contents not changing with coded page change

    Can you make a new simple workbook, with just 2 userforms, the multipage and controls that exhibits the issue?

    I can't begin to think how you would have even managed this have you re-booted your machine?

  5. #5
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: Multipage Control - Page Contents not changing with coded page change

    Hi Kyle ... I've stripped down my application of all modules, forms and data "redundant" to recreating this problem. The workbook is available at the link provided below.

    When you open the workbook, worksheet "FRONT" will open allowing you to click on one of four macro enabled objects. Click on Staff.
    A userform (uf9_poststaff) will appear. You will see the multipage control (Multipage1) with 3 page tabs ... MAIN, CUPE, STUDENT.
    Click CUPE or STUDENT. The page will change and display a series of textbox controls on their respective sheets. At the same time, a second userform will appear (uf9c_idate) allowing the user to select a date.
    By clicking the CANCEL button on this form, you should (if experiencing the same problem) see uf9c_idate disappear, to reveal the original uf9_poststaff userform. You will notice the page contents have not changed, but the MAIN tab is the "active" tab.

    https://drive.google.com/file/d/1Ecd...ew?usp=sharing

    If you do not get the same results, then clearly there is something rooted deeper in unrelated areas of my code or a local Excel apllication problem.

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    2016 Win10
    Posts
    6,680

    Re: Multipage Control - Page Contents not changing with coded page change

    Apparently, this is a fairly common issue where you attempt to change the page within the change handler. I can replicate it with a single userform with a multipage on using only:
    Please Login or Register  to view this content.
    So this isn't specific to your workbook or set up. This link suggests a workable approach: https://www.ozgrid.com/forum/forum/h...ays-wrong-page
    Quote Originally Posted by rory
    Best solution I can suggest is to not allow the user to use the tabs to change pages. Hide the tabs and replace them with your own buttons that only change page after validating the current data

  7. #7
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: Multipage Control - Page Contents not changing with coded page change

    Hey Kyle ...

    Thanks for investigating this a bit deeper on my behalf. The result is a bit disappointing though. The multipage control is a very user friendly and real estate conservative option to what I need to do. The multipage control works wonderfully when the user manipulates the tabs, so it seems like only when a control change is coded that they act up.

    I'll have to digest the recommendation and see if I can figure out what needs to be done to adapt my application.

    Thanks again!!

  8. #8
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: Multipage Control - Page Contents not changing with coded page change

    I'm not finding that this solution is meeting my needs. Maybe I'm misinterpreting the problem and recommended solution, but I am already trying to change the multipage with a button. As mentioned, the user has no problem selecting the different pages through the tab selection. I don't know what I need to do to adapt my process of switching multipages from a command button from a second form.

  9. #9
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    2016 Win10
    Posts
    6,680

    Re: Multipage Control - Page Contents not changing with coded page change

    The issue is that you’re trying to change the page within the change event handler. The suggested solution is to hide the tab selectors, replacing them with command buttons. So to get to the second tab, you click the button rather than the tab indicator. This means that you do the validation before the tab actually changes I.e in the command button click and simply not change the tab value should the validation fail.

    In your case this means calling the date picker from the command button. If the user cancels the date picker, don’t change the multi page value, so they’re still on the first tab. If they pick a valid date, then you can change the value of the multi page

  10. #10
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    [SOLVED] Re: Multipage Control - Page Contents not changing with coded page change

    Thanks so much Kyle for that explanation. I think I have it figured out now. Just in the process of testing and (knock on wood), things appear to be working OK. I'm going to test a bit more and develop more of the application before I mark it solved just in case!
    I changed the controls from commandbuttons to togglebuttons ,which with some help from others at this forum, made to mimick the tabs of the multipage control.
    Last edited by Jenn68; 03-15-2018 at 08:47 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1