Results 1 to 8 of 8
  1. #1
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100

    Query using all rows of a list box

    Is it possible to have a query use all the rows of a list box (turn off the filter) when using two list boxes to drive a query?



    Example:
    List box 1 contains all the teams in my fantasy baseball league
    List box 2 contains all the MLB teams
    The list boxes pull from a table of MLB Players
    User wants to find all the fantasy league players from the Cincinnati Reds
    OR
    User wants to find all the players for one fantasy league team regardless of the MLB team

    BTW, I am not fixed with list boxes. If there is an option which might be better, I can certainly give it a try.

  2. #2
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    Nearly 50 views and no replies... Let me try rephrasing.

    Is it possible to add an element to a list box to allow a query based on the selection from that list box to select all the rows in the list box? If so, I can't figger out how.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929

  4. #4
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    Good stuff there which will help on some other situation I am encountering, but not quite what I am looking for.

    I am currently trying to apply this idea.

    http://support.microsoft.com/kb/210290

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2007
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Which are you doing - the function or the UNION? Show the RowSource statement for analysis.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Quote Originally Posted by oleBucky View Post
    Good stuff there which will help on some other situation I am encountering, but not quite what I am looking for.

    I am currently trying to apply this idea.

    http://support.microsoft.com/kb/210290

    Take a look at this one
    http://www.tek-tips.com/faqs.cfm?fid=2330

  7. #7
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    Quote Originally Posted by orange View Post
    That worked exactly as I envisioned! I will add it to my Terribly Twisted Query Tale and work on the next step. I have three list boxes and one text box I am trying to integrate. I will post if I run into a problem.

  8. #8
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    Quote Originally Posted by oleBucky View Post
    That worked exactly as I envisioned! I will add it to my Terribly Twisted Query Tale and work on the next step. I have three list boxes and one text box I am trying to integrate. I will post if I run into a problem.
    One little glitch. I originally plagiarized the SQL as follows:

    Code:
    SELECT T1.HLBTeamID AS HLBID, T1.TeamName AS HLBName
    FROM tblHLBTeams AS T1
    ORDER BY HLBName;
    
    UNION
    
    Select "*" AS HLBID, "(All HLB Teams)" AS HLBName
    FROM tblHLBTeams AS T1;
    This worked until I closed the form then reopened it. Upon reopening, Access opened a message box asking me to "Enter Parameter Value" for HLBName. You could cancel through this, then use the list box as intended. However, I did not want the message box. Out of blissful ignorance I tried reversing the SQL sequence to:

    Code:
    Select "*" AS HLBID, "(All HLB Teams)" AS HLBName
    FROM tblHLBTeams AS T1;
    
    UNION
    
    SELECT T1.HLBTeamID AS HLBID, T1.TeamName AS HLBName
    FROM tblHLBTeams AS T1
    ORDER BY HLBName;
    For whatever reason, this eliminated the message box. Might someone provide insight as to why?

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

Similar Threads

  1. Replies: 2
    Last Post: 04-18-2011, 02:46 PM
  2. Query only certain rows?
    By 10 Gauge in forum Queries
    Replies: 48
    Last Post: 03-22-2011, 01:05 PM
  3. Repeated rows in query-form
    By astraxan in forum Forms
    Replies: 2
    Last Post: 05-23-2010, 10:25 PM
  4. Subtract Rows in Query Results
    By Sengenbe in forum Queries
    Replies: 5
    Last Post: 02-08-2010, 06:05 PM
  5. Adding rows on cross-tab query report
    By KahluaFawn in forum Reports
    Replies: 2
    Last Post: 02-18-2009, 10:09 AM

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