Consulting

Results 1 to 11 of 11

Thread: using Multipage within a Multipage form

  1. #1
    VBAX Mentor
    Joined
    Apr 2009
    Location
    Kingsbury
    Posts
    423
    Location

    using Multipage within a Multipage form

    HI
    I Have a Multipage form with 12 pages on it, I have added to page 4 another Multipage (13 & 14) Multipage2
    when a user enters data on Multipage2.Page13 and Updates the data, Page 13 is then hidden & should then show Page14 but it doesn't
    Have tried the code below without success

    Me.MutiPage2.Page14.Visible=True
    Me.MultiPage2.Page13.visible=False

    This works in a sense, it Shows Page 14 But with the fields From Page 13
    How do 1 get it to show Page 14 with the relevant fields that only apply to Page 14
    Tried setting the Values to1 & 0 doesn't work ?
    Rob

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    This works in a sense, it Shows Page 14 But with the fields From Page 13
    How do 1 get it to show Page 14 with the relevant fields that only apply to Page 14
    When you dropped the data field controls onto MultiPage2, are you SURE you put them on your Page13?

    Paul

  3. #3
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Try this. It should show Page14.
    MultiPage1.Value = 13

  4. #4
    VBAX Mentor
    Joined
    Apr 2009
    Location
    Kingsbury
    Posts
    423
    Location
    Hi Paul & Mike
    Thanks for the reply

    Paul the text boxes are hard coded on the form
    Mike tried this it error's out with 438 code

    Have attached a sample form which works as it should but when I use this code in mine it doesn't work still shows the data on Prev Page 13

    Cannot for life of me see why it does not work on my routine, got me baffled!
    Rob
    Attached Files Attached Files

  5. #5
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Did you adjust the controls name in the code I wrote?

    Also have you considered setting the .TabStyle property of the MultiPage to fmTabStyleNone and not fiddling with the visibility of the non-active pages. It looks like all the nagivation on MultiPage2 is done by controls and not by the user clicking on the tabs.

  6. #6
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    Have attached a sample form which works as it should but when I use this code in mine it doesn't work still shows the data on Prev Page 13

    Cannot for life of me see why it does not work on my routine, got me baffled!
    Since the logic seems to work in the WB you posted, I still think you should double^2 check the control placements in the real WB

    I put a breakpoint on the Initialize event and used the Immediate Window to check the .Parent up the line.

    Paul
    Attached Images Attached Images

  7. #7
    VBAX Mentor
    Joined
    Apr 2009
    Location
    Kingsbury
    Posts
    423
    Location
    Hi Mike & Paul

    Have rechecked all codes & controls they are all correct to example posted
    Been doing a bit of research and a lot of debugging within the code and found that the value of Multipage2.value always remaining at 0, the value doesn't change even when its in the programme code.

    I found article on the msn forum where somebody else had the same problem, it seems like there is a bug in excel 2007 -2010, if trying to change the value programmatically.
    Evidently it needs an Event to take place on the form ! to activate the change event ( which changes the value of the multipage2 from 0 to 1

    So I changed the routine from the AfterUpdate on the textbox & transferred the code into a Command button (Which creates a click event), which in turn activated the change event(even though there was no code in the event)

    The form now works as it should, but have you any idea's how to activate the change event, not using the command button ??
    Why does MultiPage2 need this routine ?

    Rob
    Last edited by Rob342; 11-26-2013 at 01:50 PM.

  8. #8
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Have you considered my suggestion to keep all the pages visible, but eliminate the tabs.

    From within the userform code module, you can trigger CommandButton1's Click event with
    Call CommandButton1_Click
    .
    If you want to call it from outside the uf code module, change the Private declaration to Public and use
    UserForm1.CommandButton1_Click

  9. #9
    VBAX Mentor
    Joined
    Apr 2009
    Location
    Kingsbury
    Posts
    423
    Location
    Mike, Paul

    Mike the command button call does not work, I have managed to replicate the problem on the attached.
    If you input "Y" on Tb2 Page 8 nothing happens, which has the call code in the after Update.
    Have all tabs visible.

    If you press the command button on the Page 8 then it works ok, How do you explain that ?

    Rob
    Attached Files Attached Files

  10. #10
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Change the Button's TabStop property to False and then your AfterUpdate will work. Without that change, the focus must return to the button after your AfterUpdate code runs.
    Be as you wish to seem

  11. #11
    VBAX Mentor
    Joined
    Apr 2009
    Location
    Kingsbury
    Posts
    423
    Location
    Thanks Aflatoon
    That works, I have hidden a spare button on the form.
    Rob

Posting Permissions

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