Results 1 to 5 of 5
  1. #1
    PorscheMan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2013
    Posts
    4

    HELP Referencing Columns in a List Box

    I have a List Box with two columns. Column 1 is bound. In a query, I am referencing the List Box as the criteria. [Forms]![frmSelect]!


    [List0]. I am able to retrieve the expected data from Column 1. I would like to use Column 2 in another query. How do I reference Column 2 in my List Box? [Forms]![frmSelect]!
    [List0]! ??????

    Any help appreciated. Thanks

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Try:
    Code:
    [Forms]![frmSelect]!
    [List0].Column(1)
    (the column property is zero based)

  3. #3
    PorscheMan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2013
    Posts
    4
    [Forms]![frmSelect]!
    [List0].Column(1) did not work

    I get an error message Undefined function '[Forms]![frmSelect]!
    [List0].Column' in expression

    I tried bracketing [Column(1)] and removing the parenthesis around the number 1 - no such luck.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Sorry..
    I missed the fact that you were using a query. I can't get the ".Column(1)" to work either.

    Here is a work around.
    Add an unbound text box on the form "frmSelect".
    In the after update event of "List0", add
    Code:
    Private Sub List0_AfterUpdate()
      Me.Text2 = Me.List0.Column(1)
    End Sub
    Change "Text2" to your text box name.

    In the query criteria, enter
    Code:
    [Forms]![frmSelect].[Text2]
    (again, change Text2 to your text box name)


    Another work around would be to create the SQL for the query in code and update the SQL property of the saved query.

  5. #5
    PorscheMan is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2013
    Posts
    4
    I will use the work around as it seems the easiest way. Thanks again for the help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. List spread over three columns
    By Al77 in forum Reports
    Replies: 5
    Last Post: 02-29-2012, 10:45 AM
  2. Valdiation on list and columns level
    By hasan in forum Access
    Replies: 0
    Last Post: 01-20-2012, 09:24 AM
  3. Replies: 1
    Last Post: 11-29-2011, 11:17 AM
  4. List box columns
    By 10 Gauge in forum Forms
    Replies: 14
    Last Post: 03-10-2011, 10:26 AM
  5. Referencing drop down list from form
    By akyramid in forum Queries
    Replies: 1
    Last Post: 03-01-2011, 05:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums