Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo Box Value (Access 97)

    I have a combo box, and I am trying to get the selected value in the combo box to appear in a textbox on the form. There is a number and a description in the combo box. I want them to appear in two separate textboxes so i can edit them. Any help is appreciated.

    Nick

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box Value (Access 97)

    What should happen if the user selects a value in the combo box? Do you want to look up a record based on the value?
    Are the number and the description in two different columns of the combo box, or in the same column?

  3. #3
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box Value (Access 97)

    When the user selects a value form the combo box, it will lookup the value based on what is picked. The values in the combo box are concatenated from values in the table. They are not in separate columns.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box Value (Access 97)

    To make sure I understand correctly, do you have code in the After Update event of the combo box to find a record?

  5. #5
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box Value (Access 97)

    Now I have the code:
    SELECT tblBillingCode.[BillingCode] & " - " & tblBillingCode.[Description] as FullDesc , tblBillingCode.[BillingCode], tblBillingCode.[Description] FROM tblBillingCode ORDER BY tblBillingCode.[BillingCode];
    in the row source for the combo box. I want the textboxes for billing code and description to fill in when i select a particular billing code from the combo box. there is no code in the after update event for the combo box

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box Value (Access 97)

    Write the following procedure for the After Update event of the combo box. Replace ComboName by the name of your combo box, and txtBillingCode and txtDescription by the names of the text boxes to be filled.

    Private Sub ComboName_AfterUpdate()
    If IsNull(Me.ComboName) Then
    Me.txtBillingCode = Null
    Me.txtDescription = Null
    Else
    Me.txtBillingCode = Me.ComboName.Column(1)
    Me.txtDescription = Me.ComboName.Column(2)
    End If
    End Sub

    The columns in a combo box are numbered starting at 0, so we use Column(1) to refer to the second column, etc.

Posting Permissions

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