Results 1 to 7 of 7

Thread: Dropdown list in a query

  1. #1
    asherbear is offline Novice
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    13

    Dropdown list in a query

    I have a parameter query with the [ ] where the user types in a name. I have tried to set up a drop down list for the user to choose from. But I can't seem to be able to set up the list.

    I have a table I can reference that has the data to choose from but can't figure out how to grab it. Do I need some SQL? (not my specialty) or am I missing something?? Any help is appreciated.

    Asher
    Last edited by asherbear; 05-31-2010 at 05:38 PM.

  2. #2
    ConneXionLost's Avatar
    ConneXionLost is offline Simulacrum
    Windows XP Access 2003
    Join Date
    Jan 2010
    Location
    Victoria, Canada
    Posts
    291
    As you have seen, a parameter query brings up a "dialog box" (a small built-in form) to receive input from the user. The Dialog Box provides only the most basic of functionality for it's intended purpose. If you want more functionality, like the use of a combo-box / drop-down list, then the best approach is to build a form that does the job of the dialog box (and more).

  3. #3
    asherbear is offline Novice
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    13

    A form that is referenced in the query??

    So I should create a form using the table that has the 10 or 11 choices. Then reference that form in the query? Is that the best way of stating it??

    Asher

  4. #4
    ConneXionLost's Avatar
    ConneXionLost is offline Simulacrum
    Windows XP Access 2003
    Join Date
    Jan 2010
    Location
    Victoria, Canada
    Posts
    291
    Almost.

    You need to create a form (unbound is fine), and put a combo box on the form. The combo box needs to show the list of choices. You can do that by building a simple query for the combo box to use (preferred) or you can just link the table to the combo box (this is okay if the table is a lookup table).

    Once the form is ready, you need to have your parameter query reference the combo box on the form. You should do this in place of asking for the parameter [] on the query criteria line. You can use the Expression Builder for this if you're unsure of the syntax.

    Now that the query is ready, you can go back to your form and add a button to run the query.

    Cheers,

  5. #5
    asherbear is offline Novice
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    13

    Almost there on my dropdown query

    Almost there. I have created a form with a combo box which shows the dropdown choices. Do I put something like this in the query
    HTML Code:
    [forms]![formname]![formfield]
    . When I do this it does not seem to work.

    Asher

  6. #6
    ConneXionLost's Avatar
    ConneXionLost is offline Simulacrum
    Windows XP Access 2003
    Join Date
    Jan 2010
    Location
    Victoria, Canada
    Posts
    291
    Something like this:
    Code:
    [Forms]![frmChoice]![Combo0]
    In this case, the name of my form is "frmChoice", and the name of the combo box is "Combo0".

    Note ~ Once you've added this criteria in the query, the form must be open for the query to run. In other words, open the form, make a selection with the combo box, then go to the query (while the form is still open) and run the query.

    Cheers,
    Last edited by ConneXionLost; 05-31-2010 at 09:44 PM.

  7. #7
    asherbear is offline Novice
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    13

    My problem

    It should work but I have a data mismatch. My problem. Has to do with how I initially set up my queries. (I mistakenly used the lookup function and it's referencing a number and not text. I'll have to fix that. Anyway.

    Thanks for the help. thanks for your patience. I'll mark it as solved.......

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

Similar Threads

  1. Access 2003 Dropdown slow to load
    By pskaalen in forum Access
    Replies: 1
    Last Post: 05-27-2010, 08:53 AM
  2. Minimizing combo dropdown on click
    By DanW in forum Forms
    Replies: 2
    Last Post: 11-18-2009, 01:33 PM
  3. Dropdown - need help please
    By sullyman in forum Access
    Replies: 8
    Last Post: 10-26-2009, 06:48 PM
  4. How to make a Column in Access a DropDown
    By JohnGrove in forum Access
    Replies: 4
    Last Post: 03-10-2009, 06:56 AM
  5. Drop Down, link to another dropdown
    By davelliott in forum Forms
    Replies: 3
    Last Post: 05-23-2006, 07:05 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
  •  
Tech Forums: Microsoft Office Forums