+ Reply to Thread
Results 1 to 9 of 9

Get data from ListBox on MultiPage

  1. #1
    Registered User
    Join Date
    05-12-2020
    Location
    Wales
    MS-Off Ver
    365
    Posts
    82

    Get data from ListBox on MultiPage

    I am using the following to extract from a ListBox when a button is pressed. This ListBox (lstTracker) is on a MultiPage (Page 0),

    In Module
    Please Login or Register  to view this content.
    From CommandButton
    Please Login or Register  to view this content.
    I have similar code regarding a ListBox(lstRequestDetails) on a MultiPage (Page1) but I can't get the data from a selected line back into the TextBox on the UserFrom.

    lstRequestDetails populates ok when I send data to the sheet, so why doesn't it send back to the TextBox?

    Can anyone please explain...
    Last edited by AndyEd; 03-28-2024 at 10:02 AM.

  2. #2
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Get data from ListBox on MultiPage

    Are you able to post your workbook?
    I'm not sure why Function Selected_ListTracker is in a module and not the userform?

  3. #3
    Registered User
    Join Date
    05-12-2020
    Location
    Wales
    MS-Off Ver
    365
    Posts
    82

    Re: Get data from ListBox on MultiPage

    Posting it right now would need sanitising a load of stuff. I understand why you're asking though...



    This is what the first page looks like. On the second page is a further control.

    When the user clicks the Edit button the control boxes you can see are populated with data from the selected record in the ListBox. It works for the page you can see, but I can't get the data from the ListBox on the next page (Page = 1) to populate the controls there. The code posed above works for the controls on the page you can see.

    I'm assuming it's something to do with referencing the MultiPage Page reference, but I'm not sure, as I can populate the ListBox on the other page simply by referring to it, e.g. lstName.

    I used the code from an online tutorial and in it they placed the Function Selected_ListTracker code in a Module? Outside of that I'm not sure why they did it that way, sorry.

    Is this any help?
    Attached Images Attached Images

  4. #4
    Registered User
    Join Date
    05-12-2020
    Location
    Wales
    MS-Off Ver
    365
    Posts
    82

    Re: Get data from ListBox on MultiPage

    Scratch that! Why am I being so stupid? Why am I expecting a selection in one ListBox to populate controls from a record in another ListBox.

    How on earth am I going to get around this?
    Last edited by AndyEd; 03-28-2024 at 01:42 PM.

  5. #5
    Valued Forum Contributor
    Join Date
    12-30-2020
    Location
    Odessa / Ukraine
    MS-Off Ver
    2021
    Posts
    302

    Re: Get data from ListBox on MultiPage

    @AndyEd
    Are you able to post your workbook?
    See yellow banner on top of this page. Thanks.
    NOTE: As the original poster/owner, only you can mark your thread as SOLVED (Thread Tools above Post #1).
    You can say "Thanks" in your thread to everyone who offered to help you.
    You can also reward them by clicking * "Add Reputation" under their username on the left.
    With Regards, MikeVol.

  6. #6
    Registered User
    Join Date
    05-12-2020
    Location
    Wales
    MS-Off Ver
    365
    Posts
    82

    Re: Get data from ListBox on MultiPage

    Sorry, so a copy of the workbook is attached.

    What I'd like to achieve is that when the user selects a record in the listbox it populates the corresponding controls on the page. I'd like that to be the case on the listbox on page 2 as well, so the control is populated with the data from the record selected in the listbox on page 1.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    12-30-2020
    Location
    Odessa / Ukraine
    MS-Off Ver
    2021
    Posts
    302

    Re: Get data from ListBox on MultiPage

    I don’t know, maybe that’s not what you wanted? I did it as I understood you, see the example file. There are some changes, please pay attention. Good luck.

  8. #8
    Registered User
    Join Date
    05-12-2020
    Location
    Wales
    MS-Off Ver
    365
    Posts
    82

    Re: Get data from ListBox on MultiPage

    Thank you MikeVol, that is exactly what I needed.

    Can I ask another question? It is related but let me know if it needs a new post.

    Can the record of the second ListBox be displayed based on the selection in the first?

    For example, the user selects a record in a ListBox and the appropriate controls are populated. Can this selection determine the selection in a separate ListBox? Even if that ListBox is loaded via a separate UserForm, via a CommandButton?

    Thank you again.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Get data from ListBox on MultiPage

    I would advise you to mark this thread as solved and start a new one for your next query with a suitable title and workbook attached.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. resize the listbox & userform based on populated data in listbox
    By Mussa-A in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-03-2022, 09:14 AM
  2. Replies: 1
    Last Post: 04-12-2022, 04:38 PM
  3. VBA Multipage Userform.: transfer textbox fields from a multipage userform to a cell
    By TheGiantJudge in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-31-2019, 01:26 PM
  4. Replies: 0
    Last Post: 05-06-2019, 03:36 PM
  5. 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
  6. [SOLVED] ActiveControl - Return non-Multipage control when Form contains Multipage?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-04-2014, 08:37 PM
  7. Listbox to Listbox, no duplicates & submitting same UserForm data for each Listbox entry.
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2012, 12:18 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