• Combo Box Value (Access 97)

    Author
    Topic
    #412943

    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

    Viewing 1 reply thread
    Author
    Replies
    • #907303

      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?

      • #907316

        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.

        • #907318

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

          • #907324

            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

            • #907330

              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.

            • #907331

              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.

          • #907325

            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

        • #907319

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

      • #907317

        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.

    • #907304

      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?

    Viewing 1 reply thread
    Reply To: Combo Box Value (Access 97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: