Results 1 to 14 of 14
  1. #1
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209

    Selection List for Query

    Is there a way to have a drop down list to select from for your query. For example, let's say that I want to view a certain users intries. The form is set up to record the user that input the data's windows id, which interprits the data to a "Real Name" so I already have a table with the names in it. What I am wanting is to create a query that will prompt you to input the "Real Name" (which I know how to do that part) but I want the query to give a drop down box with a list of all the "Real Names" so you can choose the name from the list instead of having to know the correct format to put the name in. Is this a feasible thing?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Yes, but you can't use [Enter whatever] as a query criteria. You need to use a form with a combo or list box, and point to it in the criteria:

    Forms!FormName.ComboName
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209
    It no possible, to point the query to a form where I have data saved? I must use the comboname from a form?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm not clear on the question. You can point to any form; my point was that to get a list of valid selections, you need to use a form. I assumed you were trying to get a listing with a bracketed query criteria, which you can't.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209
    Sorry, I type my questions wrong. It no possible in the query to point to a table (an not a combox on the form) where I Have my names saved?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    A single record in the table, or all of them? All of them is possible, either with a join or a subquery.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209
    All of them, when you click on the query, I want it to drop down box with names in it and you choose the person you want to view data on.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You want all of them available to choose from, but the user will select one. You need to use a combo box on a form. The combo will get its values from your table with names. The user selects one and then runs your query (presumably via form or report).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209
    So there is no way on the query to have it pop up and ask me to input name, and instead of having to input a name, I can choose a name from a drop down menu (which would be all of the names from my cbo box)

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    That is correct; you can only get a drop down list with a form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209
    What if I changed the output to a report, would it be possible to have the selection list on a report instead of a query? Or is it still not possible?

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Not in 2002; reports are not dynamic (you can't click on a list). Why are you avoiding using a form? It is the normal method of interacting with the user.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    Juan4412 is offline Competent Performer
    Windows 7 Access 2002
    Join Date
    Dec 2010
    Posts
    209
    Is it possible to use a form, to display the data that I am wanting to? If so, how would I set it up?

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sure, you can base a form on the same query a report is based on, or use a technique like this to restrict the records:

    http://www.baldyweb.com/wherecondition.htm

    My rule of thumb is to use a form if the user will need to interact with the data (add/edit/delete), a report if they're just viewing the data.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 04-05-2011, 06:12 PM
  2. Replies: 2
    Last Post: 08-03-2010, 10:16 AM
  3. Bring up record according to list box selection
    By dlewicki in forum Programming
    Replies: 4
    Last Post: 03-01-2010, 03:54 PM
  4. Checking List Box Value with Combo box selection
    By empyrean in forum Programming
    Replies: 1
    Last Post: 10-23-2009, 06:01 PM
  5. Replies: 1
    Last Post: 03-09-2006, 12:12 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