Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    83

    Unanswered: Getting the Table Value from a Combobox

    I've got a combobox populated with names from a table, I'm trying to return the unique key (example "Jones, Bob" would be 112) when they hit a button. The problem is that I have no idea how to write the code for something like that.

    "UserID = '" + cboName.Value + "'"

    That will obviously return the text in the combo not the corrosponing value in the table.

    Any suggestions?

    Thanks
    Steve

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    You have to adjust the number of coulmns of the combo box to 2 then
    write the next code in the change event of your Combo
    PHP Code:
    Private Sub yourComboBox_Change()
      
    anyTextBoxName yourComboBox.Column(1yourComboBox.ListIndex)
    End Sub 

  3. #3
    Join Date
    Mar 2004
    Posts
    83
    Perfect, works like a charm now. Now I notice that the combo now has a horizontal scrollbar (to show the new column), is there a way to either make that hidden, or to hide column 2 itself?

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by High_D
    Perfect, works like a charm now. Now I notice that the combo now has a horizontal scrollbar (to show the new column), is there a way to either make that hidden, or to hide column 2 itself?
    In the combobox properties, set the Column Width to 0 ... Ex:

    0";1" - Hides the 1st column ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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