Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Brookline, Massachusetts, USA
    Posts
    606
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Parameter Query (97)

    I have a cemetery database where the burial lots are organized by section (B thru R). I have created a parameter query to give me a list of lots by section (for a report). It uses the Between...And operators to ask the user for the first section and the last. My problem: I really want to display one of two conditions: one section, or all sections. I would like to use only one parameter. How do I select "all" with only one parameter?

  2. #2
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Parameter Query (97)

    There may be more elegant solutions than this, but here's one that should work: Add "A" = [Enter Section] to your WHERE clause (with OR logic): e.g., something like ([Section] = [Enter Section]) OR ("A" = [Enter Section]). "A" needs to be unique ("All" would be another choice) -- it can't be one of your legitimate Section IDs. You can do this in Design mode or SQL mode. In design mode, specify "A" (with the quotes) as the field, uncheck the Show box, and specify [Enter Section] (without quotes) as a criteria (on its own row to indicate OR logic).

    When you run the query and specify a legitimate section ID for the [Enter Section] parameter, the first subclause will pick up the lots belonging to that section. When you specify 'A' for the [Enter Section] parameter, the second subclause will pick up all the sections (that is, all the lots).

    Tom

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Brookline, Massachusetts, USA
    Posts
    606
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Re: Parameter Query (97)

    Tom,
    Thanks for the post. The SQL suggestion worked fine. I tried to do the same thing in Design View but I couldn't make it work, even though I know how to use OR logic on two lines. Did you want me to create a second column for Section?

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Brookline, Massachusetts, USA
    Posts
    606
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Re: Parameter Query (97)

    Disregard previous post. I got it to work right in Design view.

Posting Permissions

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