Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Retrieve 2nd column data (2003)

    Access help tells me that 'ItemData' would enable me to retrieve data from the bound column of a combo-box. Is there a way that I can retrieve data from the (2nd) unbound column? I'm currently doing this using the DLOOKUP function to look in the table but suspect that this is messy/ inefficient. Thanks, Andy.

  2. #2
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Retrieve 2nd column data (2003)

    Hi Andy,
    For a combobox you can just reference the column in question: i.e. Me!cboExample.Column(1) - remembering that columns are zero based (the 1st column is 0, the second column is 1, etc.)
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Retrieve 2nd column data (2003)

    Thank you, I thought it might be that simple. Slightly related question: If the row source of a combo-box is based on a query that doesn't Show a particular field, is that field's data accessible within the form? Andy.

  4. #4
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Retrieve 2nd column data (2003)

    It doesn't have to show, but it does have to be available. A combobox has a Column Count property. If your RowSource returns, say, 3 fields, your Column Count must therefore be 3, for all your returned fields to be accessible. The Column Width property can hide the columns that are not necessary for a user to view. So in your 3 field RowSource you may have ColumnWidths of 0";0";2" which means Column(0) and Column(1) are hidden but still accessible.
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

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

    Re: Retrieve 2nd column data (2003)

    No, you'll have to add the field to the query, and adjust the column count of the combo box. You can keep the field hidden by setting the column width of the corresponding column to 0 in the Column Widths property of the combo box.

  6. #6
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Retrieve 2nd column data (2003)

    Cool, top man.

Posting Permissions

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