+ Reply to Thread
Results 1 to 11 of 11

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
    Office 365
    Posts
    371

    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
    365 Win 11
    Posts
    7,238

    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
    Office 365
    Posts
    371

    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
    365 Win 11
    Posts
    7,238

    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
    Office 365
    Posts
    371

    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
    365 Win 11
    Posts
    7,238

    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
    Office 365
    Posts
    371

    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
    Office 365
    Posts
    371

    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
    365 Win 11
    Posts
    7,238

    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
    Office 365
    Posts
    371

    [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.

  11. #11
    Registered User
    Join Date
    01-26-2022
    Location
    Maine, USA
    MS-Off Ver
    Office 365
    Posts
    1

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

    I had the same problem: multipage.value = x did not change the tab.

    On my form, I have many input fields - text, combos, etc. Some are required fields, some are not. In order to move to the next tab, the required fields must have valid data. So every time a required field is satisfied I check the other required fields. If all are satisfied I kick off a process to save the information then move to the next tab. This process is kicked off in the AfterUpdate event in each of the required fields. Whichever one gets updated last kicks off the process.

    During that process is when I would try to select the next tab but it would not change.

    When stepping through code, multipage tabs are 'active': you can click on them and they change. They are 'alive'. But I noticed that during the code where I was trying to change the tab, the tabs were 'dead'. It was like the form itself was not enabled despite checking it and verifying it was enabled. But after the code completed, everything seemed to come back to life.

    It turns out that during an AfterUpdate event, the form is essentially 'dead'. You can't change the tab manually by clicking on it nor in code. I had to reconfigure my code so that I didn't try to move to the next tab until after the AfterUpdate event completed.

    Not sure if that's what causing others heartburn, but it was for me.
    Last edited by Troy.G; 01-26-2022 at 10:19 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Change selected page in MultiPage form
    By Don Hinz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-14-2017, 12:18 PM
  2. how to switch multipage page from multipage change event??
    By jed38 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-27-2015, 10:31 AM
  3. Replies: 4
    Last Post: 08-28-2014, 02:23 AM
  4. [SOLVED] Multipage Activex Control - How do I Embed Code in each Page?
    By vba_beginner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-10-2013, 02:26 PM
  5. Change page of multipage with click of checkbox
    By Cherub in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2011, 02:32 AM
  6. Changing the Color of Page on a MultiPage Form
    By NaNaBoo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-31-2009, 04:21 AM
  7. change font color whenever click a page of multipage control
    By tom taol in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-12-2005, 06:05 PM

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