Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    163
    Thanks
    2
    Thanked 0 Times in 0 Posts

    list in parameter query (97)

    Is it possible to create a parameter query that would have a list for the user to choose from?

    eg. If I had a list of cities that customers lived in, and wanted the data just on those who lived in London, could the user select from a list and choose London. At them moment I have separate queries for each choice as it avoids spelling mistakes on the part of the user, but being able to choose from a list would eliminate the need for several different queries.

    Also would it be possible if I were to use such a query to generate a report, that the entered data (London) could be incorporated into the title of the report?

    Thanks for any suggestions.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: list in parameter query (97)

    You'll have to use a form with a listbox or combobox and reference that form and control in the criteria line of your query.
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Posts
    163
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: list in parameter query (97)

    Thanks Charlotte, but can I ask another question? How do I reference the form in the criteria.

    I created a table called tblType and a Field called Cities so in my form called frmTypeSelect I made a combo box called cboTypeCities.

    In my criteria on the query I tried
    =[Forms]![frmTypeSelect]![cboTypeCities]
    but when I run the query I still have to type London in.

  4. #4
    David Peel
    Guest

    Re: list in parameter query (97)

    Make sure that the form is open (in form view) when you run the query (ideally run the query from a command button on the form).

    If still not working, check the rowsource of the combo box and ensure that the bound column returns the name of the city, rather than an index field.

Posting Permissions

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