+ Reply to Thread
Results 1 to 7 of 7

Error Attempting To Poplate A Textbox From A Value From A Selected Listbox of Another Form

  1. #1
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Professional Plus 2019
    Posts
    322

    Error Attempting To Poplate A Textbox From A Value From A Selected Listbox of Another Form

    Userform 1 holds a textbox (textbox1).
    Userform 2 (test_mr) has a listbox (miss_rn)

    I am trying to populate textbox1 with the value selected in miss_rn.

    I have this, which is giving me an 'Object required' error.

    Please Login or Register  to view this content.
    This line is found in the initilaize code of userform1.

    Thoughts?

  2. #2
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Professional Plus 2019
    Posts
    322

    Re: Error Attempting To Poplate A Textbox From A Value From A Selected Listbox of Another

    Tried this also, and got "Invalid or unqualified reference."
    Please Login or Register  to view this content.
    Anyone? Such a simple (I hope) hurdle is becoming a major roadblock.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,076

    Re: Error Attempting To Poplate A Textbox From A Value From A Selected Listbox of Another

    Hello Jenn68,

    My first question is, "Are both UserForms loaded? "

    A UserForm and it's controls can only be addressed when the UserForm is loaded into memory. Customarily, only one UserForm is displayed at a time. However, other UserForms can remain loaded in memory and not be visible until needed.

    Your second post is a period with ListIndex. This would indicate the code is inside a With ... End With statement. Since the code shown is not the complete macro, it is unclear this is the case.

    Provided the second UserForm is loaded then this should work for you.

    UserForm1 Code
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Professional Plus 2019
    Posts
    322

    Re: Error Attempting To Poplate A Textbox From A Value From A Selected Listbox of Another

    Thank you soooo much Leith forcoming to my rescue ...

    Please Login or Register  to view this content.
    If .ListIndex > -1 Then
    TextBox1.Value = .List(.ListIndex)
    End If
    End With[/code]

    The line in red is still leaving me with an "Object required." error. ;-(

    Quote Originally Posted by Leith Ross View Post
    Hello Jenn68,

    My first question is, "Are both UserForms loaded? "
    I believe both forms are loaded. They are both visible if thats the same as 'loaded'? There is actually 3 userforms visible, all have their ShowModal properties = False.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,076

    Re: Error Attempting To Poplate A Textbox From A Value From A Selected Listbox of Another

    Hello Jenn68,

    I'll see if I recreate the error using a couple of UserForms.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    6,207

    Re: Error Attempting To Poplate A Textbox From A Value From A Selected Listbox of Another

    This means one of the names is propably misspelled.

    Can you post an example file ?
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    2007
    Posts
    3,086

    Re: Error Attempting To Poplate A Textbox From A Value From A Selected Listbox of Another

    Note this has been cross-posted here
    Last edited by Trebor76; 05-13-2019 at 12:52 AM.
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

+ 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