Consulting

Results 1 to 2 of 2

Thread: Combobox Question

  1. #1

    Combobox Question

    I have a 2 column combobox on an Access form that gets its values from two fields: ID and Name. The first column (ID) has a 0" width and is not visible when the form is displayed.

    How do I set the value of the combobox to be equal to a specific ID number? In other words, how can I display a specifc name in the combobox by referencing its hidden ID number.



    Thanks

  2. #2
    VBAX Regular
    Joined
    Jul 2004
    Location
    San Bernardino, California
    Posts
    69
    Location
    Quote Originally Posted by Hopeless
    I have a 2 column combobox on an Access form that gets its values from two fields: ID and Name. The first column (ID) has a 0" width and is not visible when the form is displayed.

    How do I set the value of the combobox to be equal to a specific ID number? In other words, how can I display a specifc name in the combobox by referencing its hidden ID number.



    Thanks
    Check the Bound Column of your Combo Box (in the properties of the combo box). If it's 1, then you are bound to your ID Column, which is good.

    So then, what you can do to set the combo box to a specific ID is something like this:

    Me.YourComboBoxName = 3
    Where 3 is the actual ID you want to set it to.

    Now, let's say you wanna reference the textual value from the second column, then you can do something like this.
    Msgbox Me.YourComboBoxName.Column(1)
    Combo Box Columns are zero-based so 1 would actually be the physical column 2.

    HTH, Thanks.

Posting Permissions

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