Results 1 to 4 of 4
  1. #1
    jambraun is offline Novice
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    2

    Populate text boxes from combo box selections and correct entries on navigation

    Hello, I happened on this forum by chance and already found answers to many things I was looking for but I'm stumped now



    I created a form to populate personnel information and instead of typing items out many times I'm using seperate tables to store the more static information. The idea is to use a combo box and based on the answer display values from the collumns in adjacent text boxes. Using an 'After Update' event, the text boxes populate just fine when I select the entry from the drop down box:

    Code:
     
    Private Sub Desk_AfterUpdate()
    Me!RoomLook = Me!Desk.Column(1)
    Me!JackLook = Me!Desk.Column(2)
    Me!PhoneLook = Me!Desk.Column(3)
    End Sub
    Now here's the problem. When changing records, going to next record / prvious record / new record, the values in those text boxes appear to be set to whatever was stored at the last combo selection. When reloading the form, the boxes are empty instead of displaying values from the combo selection.

    I know the answer is simple but it's escaped me for the past day with many attempts. Is there alternative code that I can use to populate these text boxes each time the form is opened, a different record is navigated to / a record is deleted / new record created?

    Thanks so much for your assistance!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You would need the same code in the Current event. An alternative would be to have textbox control sources like:

    =Desk.Column(1)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jambraun is offline Novice
    Windows 7 Access 2007
    Join Date
    May 2010
    Posts
    2
    Pbaldy, you ROCK!

    I knew it was something simple. I didn't understand the meaning of control sources until you posted that. Looks like that did the trick. Thanks!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help, and welcome to the site!

    The code solution would only be necessary if for some reason you had to save the values to a table. For display only, the other method is simpler.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Use a combo box to populate a text field
    By niesenj in forum Forms
    Replies: 2
    Last Post: 01-29-2010, 01:57 PM
  2. Auto-Populate Combo box
    By vincenoir in forum Forms
    Replies: 3
    Last Post: 10-14-2009, 07:06 AM
  3. Populate Combo Box
    By wes28 in forum Programming
    Replies: 1
    Last Post: 03-04-2009, 06:45 AM
  4. Replies: 1
    Last Post: 03-02-2009, 11:54 AM
  5. joining text in text boxes
    By jjwilliams73 in forum Forms
    Replies: 1
    Last Post: 08-26-2008, 02:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums