Results 1 to 11 of 11
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Now-Luanda, Angola, Originally - Anna Bay, New South Wales, Australia
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo Box as parameters for a query (2003 All Updates)

    Is there any easy way to use the equivalent of a combo box to filter a query ie when you run the query , have combo box appear with a list of allowable paramaters (eg States or countries) and have the ability to select all of them, just one or a number of them to feed the query
    TIA
    Steve
    Dummy from Down Under <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box as parameters for a query (2003 All Updates)

    Use a combo box on a form, and set the criteria to something like
    <code>
    [Forms]![NameOfForm]![NameOfComboBox]
    </code>
    The form should be open before the query is used. The form won't be opened automatically if the query is run from the database window, but since end users should never run something from the database window, that shouldn't be a problem.

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Combo Box as parameters for a query (2003 All

    <hr>just one or a number of them to feed the query<hr>

    Combo Boxes do not allow multiple selection. To allow more than one you need a list box with the multi select property set to either Simple or Extended
    Regards
    John



  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Now-Luanda, Angola, Originally - Anna Bay, New South Wales, Australia
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box as parameters for a query (2003 All Updates)

    Sorry Hans - totally lost -put the criteria where
    Steve
    Dummy from Down Under <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box as parameters for a query (2003 All Updates)

    In the design of the query, in the Criteria line of the column you want to filter on.

  6. #6
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Now-Luanda, Angola, Originally - Anna Bay, New South Wales, Australia
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box as parameters for a query (2003 All Updates)

    Following on from help by Hans and John, I attach a cut down version of the database.
    Two major tables: STKB which holds data relating to Stock and DAVEID which holds the list of GROUPS.
    The ChooseGroupsForm is designed to allow you to choose one, several or All Groups. This process is working fine (after much confusion on my part !!). However I want to apply the results of this query to the query qryProductProfitabilitySearch and have no idea how to do this.
    Any help appreciated
    TIA
    Steve
    Attached Files Attached Files
    Dummy from Down Under <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box as parameters for a query (2003 All Updates)

    You have an organizational (or design) problem that you'll have to solve before continuing. The IDCODEs in the DAVEID table do not correspond to the IDCODEs in the STKB table. For example, DAVEID contains the IDCODE "WINE", containing descriptions such as "WINES", "WINES RED", "WINES WHITE" etc. However, the records in STKB that are about wines contain IDCODEs such as REDS, WHIT and SWIN. Because of this inconsistency, you cannot join the tables on the IDCODE field. You will have to tackle this first. You'll have to decide for yourself in which table you're going to change the codes to match those in the other one. And perhaps you should use the CODENO field from DAVEID, but I don't see an equivalent field in STKB at first sight.

  8. #8
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Now-Luanda, Angola, Originally - Anna Bay, New South Wales, Australia
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box as parameters for a query (2003 All Updates)

    Hans
    Stupid of me that I didnt check.(not my database by the way)
    I think I'm there now - thnks to John and yourself for your help
    Steve
    Dummy from Down Under <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box as parameters for a query (2003 All Updates)

    I see that you edited your reply. For what it's worth, I have attached the version I created in reaction to the question in the original version.
    Attached Files Attached Files

  10. #10
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Now-Luanda, Angola, Originally - Anna Bay, New South Wales, Australia
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box as parameters for a query (2003 All Updates)

    Hans
    Thank you - the query is now working well. I had to change the source from the Table STKB to a query as there are calculated fields required in the report and I noticed that it would only read the first 4 letters of the query name (presumably because the original table source was 4 letters long). I just changed the name of the query to be 4 letters long
    However, because of my inexperience, I have had to make production of the associated report a 2 step process (2 buttons on the form)
    Button 1 calls up the query after selections are made
    Button 2 opens the report based on this query
    It works but its not pretty. Is there anyway to open the report in preview mode as soon as the groups are selected and the "run query" button clicked
    Steve
    Dummy from Down Under <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo Box as parameters for a query (2003 All Updates)

    You don't have to alter a query before opening the report. you can pass the where-condition to the report. See the attached version. The report is nothing special, just a slightly modified autoreport; it is only meant as an illustration that you can use one query and one report to display different selections.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •