text box to display combo column not key column

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyWaterloo
    New Member
    • Dec 2007
    • 135

    text box to display combo column not key column

    I have a text field that I want to display the name that is chosen in a combo box (=[Combo12]). Unfortunately the text box is only displaying the number of the record in the key column. What do I have to do to have it show what is in column 2 of the combo box instead of column 1?
  • ClearRift
    New Member
    • Feb 2010
    • 5

    #2
    The combobox uses the key column to look up the correct values to place in the box. Therefore, you need to do the same thing. This is most easily done using the dlookup function like so:
    syntax: DLookup(Express ion, Domain , Criteria)
    Code:
    =dlookup("[ColumnYouWant]","[YourTable]","[KeyColumn] = [Combo12]")
    Let me know if this helps.

    Comment

    • mshmyob
      Recognized Expert Contributor
      • Jan 2008
      • 903

      #3
      Try using the column property of the combo box.

      Me.cboBox.colum n(1) would give you the column info you want.

      Me.cboBox.Colum n(0) is what you are getting

      See if that helps.

      cheers,

      Comment

      • MyWaterloo
        New Member
        • Dec 2007
        • 135

        #4
        Thanks mshmyob, that worked great!

        Comment

        • mshmyob
          Recognized Expert Contributor
          • Jan 2008
          • 903

          #5
          You're welcome. Good luck with the rest of your project.

          cheers,

          Comment

          Working...