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

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

    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,258

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

    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,258

    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
    MO Prof Plus 2016
    Posts
    6,907

    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
    Office 365
    Posts
    3,523

    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)

Similar Threads

  1. trying to populate a listbox with rows from sheet then when selected split into textbox
    By justlearning123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2015, 06:45 AM
  2. Replies: 4
    Last Post: 12-29-2014, 02:46 PM
  3. [SOLVED] Selected Listbox Item to Textbox
    By TheRobsterUK in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2014, 04:07 PM
  4. How is it possible to fill in data from a textbox into a selected row in a listbox
    By vbastarter14 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-02-2014, 02:23 PM
  5. [SOLVED] Display Selected Item in Listbox in Textbox
    By puuts in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-14-2014, 04:19 PM
  6. [SOLVED] user form to input data according to text in textbox and listbox
    By a.hudrea in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-10-2014, 04:27 AM
  7. Textbox values won't place into selected Listbox rows
    By Julesdude in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-16-2010, 07:34 AM

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