Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2011
    Location
    Richmond, VA
    Posts
    38

    Question Unanswered: How to Reference the Unbound Column of a Combo Box in a query

    I know how to do this in VBA

    Me.cboAgency.Column(1)

    but I don't see a similar option using the function builder. I can get so far, but no farther?

    Agency_Name: [Forms]![frmMyForm]![cboAgency].column(2)

    You probably already know the .column(2) piece above will not work.

    Any suggestions?

    Thanks in advance,

    Paul

  2. #2
    Join Date
    Aug 2011
    Location
    Richmond, VA
    Posts
    38
    I guess Friday afternoon is not a good time to post a thread.

    No worries, I'll be back Monday.

    Paul

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Where do you try to use the expression?

    This works without any problem:
    Code:
        Debug.Print Forms("form34").Combo1.Column(1)
    Don't forget that the first column of a combobox or a listbox is Column(0)

    If it does not work in a query, you can always create a public function that returns the value:
    Code:
    Public Function Combo1_Column1() As Variant
    
        Combo1_Column1 = Forms("form34").Combo1.Column(1)
        
    End Function
    Then:
    Code:
    SELECT Adresses.Shipping,
           Combo1_Column1() as Combo1
      FROM Adresses;
    Have a nice day!

Posting Permissions

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