locked
SELECT statement column data RRS feed

  • Question

  • User-1684572848 posted

    What I want to do is use both columns of data from a SELECT statement independent of each other after the user has made a selection in a combo box.  Here is my select statement for the combo box with two columns:

    SELECT [Bulletin Number], [Title] FROM ServiceBulletins ORDER BY [Bulletin Number];

    Once the user has made a choice from the list, this returns the Bulletin Number in the combo box named cbo_SB_Number which I want in the table it is getting stored in.  That part works fine.

    In a text box below on the same form, I want to display the [Title] from the SELECT statement above.  I can reference the Bulletin Number as it is the value for cbo_SB_Number and I can use that without issue.  I can't figure out how to reference [Title] in an expression in a macro on 'After Update' of the combo box or whenever really.  My colleague had suggested finding data using some VBA code similar to this:

    Me.cbo_SB_Number.Column(n)

    There didn't seem to be any way the macro builder in Access 2010 would accept that syntax.

    Any ideas out there?  Thanks in advance.

    Wednesday, July 6, 2011 6:12 PM

Answers

  • User3866881 posted

    Hello:)

    Since you are now using Combobox, You must have DisplayMember and ValueMember.——So your Bulleitn Number is binded to the Combobox's ValueMember. And your Title should binded to the DisplayMember——And you can get through——

    Combobx1.SelectedItem.ToString();

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 7, 2011 10:56 PM