Access / SQL help

Discussion in 'OT Technology' started by Aimless, May 5, 2003.

  1. Aimless

    Aimless Resident drunkey

    Joined:
    Nov 5, 2001
    Messages:
    2,534
    Likes Received:
    0
    Location:
    Wisconsin
    I can't believe I'm stuck on something like this, but here goes:

    [​IMG]

    How can I filter out the choices in the listbox on the left so that only the unique ones are displayed?

    [​IMG]

    Here's the SQL statement I'm using for the RowSource of that listbox.

    If were to say something like

    Code:
    SELECT DISTINCT EmployeeProjects.project, EmployeeProjects.id FROM EmployeeProjects ORDER BY EmployeeProjects.project; 
    the id values are in the listbox instead of the project values, regardless of the BoundColumn number. The Select statement has to be in that order (id, project) for it to display the project values.

    Access > me :wtc:
     
  2. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    I don't know what you are trying to do actually. The first thing I would do is change the source to the projects table so it appears once. Now if there is no projects table, I don't know why, then you need to do a group query which will get rid of all of the duplicates. Just make sure you don't include other fields since you'll have the same problem.

    As for the boundcolumn, I'm guessing that it does work but you have a problem with display - that can simply be solved by changing the number of columns to 2, and the column width to 0" (ie 0";1"). This will allow you bind the first column but show the second in the listbox.

    I'll check tomorrow when I get in to work if you're still having problems.
     
  3. Aimless

    Aimless Resident drunkey

    Joined:
    Nov 5, 2001
    Messages:
    2,534
    Likes Received:
    0
    Location:
    Wisconsin
    There is a projects table, but the problem was that I only wanted to display the projects that were assigned. Access wouldn't allow me to just select the one EP.projects field without tacking on the id field as well.

    The display idea was right on :) -- I didn't even realize that it was technically trying to show both columns, or that you could manipulate which ones were visible through the width controls. I've got everything working now, thanks a ton.
     
  4. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA

Share This Page