Results 1 to 14 of 14
  1. #1
    Join Date
    Jun 2009
    Posts
    95

    Unanswered: Refresh Textbox Problem

    I have a form that has a combo box, a list box, and a few text boxes.

    Currently, when the user selects the combo box, the list box populates options based on the combo box selection. The text boxes on my form do not update until I select the record on my list box.

    How do I make it so my list box automatically selects the first record after I change the combo box selection? This would make my text boxes change when I changed my combo box, instead of them only changing when I select something on the list box.

    Thanks for any help,
    CT

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    This is what I use to automatically select the first item:


    Me.lstVendors = Me.lstVendors.ItemData(0)
    Paul

  3. #3
    Join Date
    Jun 2009
    Posts
    95
    Where do you put that?

    Thanks,
    CT

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    From the sound of it, add it to the code behind the combo box that changes the listbox selections.
    Paul

  5. #5
    Join Date
    Jun 2009
    Posts
    95
    This does make it so the first selection in my listbox is selected, but for some reason my text boxes are not updating/changing until I physically click the selection on the list box.

    Do you have any ideas to make it so the text box changes as well?

    Thanks,
    CT

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Try

    Me.TextboxName.Requery
    Paul

  7. #7
    Join Date
    Jun 2009
    Posts
    95
    Hey pbadly,

    I should have said this in a previous post but I had previously tried that and did once again after you suggested it again, but it was unsuccessful.

    If you have any other ideas, it would be greatly appreciated.

    Thanks so much,
    CT

  8. #8
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    What do the textboxes contain? Something like this?

    =ListboxName.Column(1)

    Can you post the db?
    Paul

  9. #9
    Join Date
    Jun 2009
    Posts
    95
    I can put together a sample database as the current one contains user sensitive information.

    The day is winding down and I really appreciate your help. First thing in the morning when I get back to the office I will put this together and post it.

    I really appreciate your help pbaldy. You have been more than helpful.

    Thanks so much and I will post the DB tomorrow,
    CT

  10. #10
    Join Date
    Jun 2009
    Posts
    95
    Here is the sample I have put together.

    Go to the brokers form, and what I am trying to achieve is for the text boxes to change when the combo box selection changes, instead of having to click the list box to get them to update.

    Thanks,
    CT
    Attached Files Attached Files

  11. #11
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You have code behind the listbox to go to the selected record (the bookmark code). All you have to do is either call that code from the combo box code or add the same code there.
    Paul

  12. #12
    Join Date
    Jun 2009
    Posts
    95
    Pbaldy,

    Thank you for your quick response, but I have tried that previously to no avail. I retried it after reading your suggestion and I copied and pasted the afterupdate event code from the listbox to the combobox and it still does not do what I am trying to get it to do.

    Am I doing something wrong?

    Thanks,
    CT

  13. #13
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Not sure. I copied all the code from the listbox and put it after the existing code in the combo. Now when I make a selection in the combo, the various address and date textboxes change values as appropriate to the selected record in the listbox (I assume; I haven't actually looked in the table). Have I misunderstood the goal?
    Paul

  14. #14
    Join Date
    Jun 2009
    Posts
    95
    That is the desired goal, however, when I am working with a larger population of data, (thousands of companies), it is not working.

    When I type in the company in the combobox and hit enter, it does not return to me the entered company's info, but it gives me the next company's info (the 2nd, then the 3rd, then the 4th, etc, as I try again).

    Does that make sense?

    Thanks again,
    CT

Posting Permissions

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