Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002

    Unanswered: populate textboxes with combo box

    How can I populate the textboxes with the values of a record that I selected in the combo box?

    This is the code I wrote

    Private Sub Combo2_AfterUpdate()
    Dim intI As Integer

    For intI = 2 To 8
    Me("txtbox" & intI) = Combo2.Column(intI)
    Next intI

    End Sub

    combo box works but the textboxes are blank.

    I want to fill the values from the record selected in the combo box to the appropriate textboxes, starting with third field to ninth field. I hidden and bound the first column but is displaying the second column in the combo box.

    These are the fields in my tblVendor:
    VendorNum- autonum
    Vendor - text (combo box)
    Address - "
    City - "
    .. .and so on

    Could you help?


  2. #2
    Join Date
    Feb 2002
    Combo boxes use the 1st column normally to store the record ID.

    1Base the form on a query using the combo box as the data criteria and requery the form on combo box update.

    2Alternatively, change the form to a sub form and hook the sub form to the combo box, requerying the sub form on the combo box update method.

    3Alternatively set the record source of the form using SQL in the update event of the combo box, using column(1) or column(0) (I get mixed up) as the record criteria and requery the form.

    4Run a recordset query on the combo box update event.

    The method you choose is up to you, but Access typically provides six or seven different ways to acheive similar outcomes. For straight searching I like form based on queryrequeired from combo box, less code to write, has to be better.

  3. #3
    Join Date
    May 2002

    populate textboxes with combo box'

    Thanks! I will give it a try.

Posting Permissions

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