Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select query (2000 SR-1)

    I have a select query that I need to select records where
    1. The [RentPaidDate] is between 2 dates fields [ReportBeg] and [ReportEnd]
    On the criteria line of the field [RentPaidDate], I used the expression Between
    [ReportBeg] and [ReportEnd]

    2. I want to further narrow the select to select only records where [PayID] is 1 or 2 or 8
    On the criteria line of the field [PayID], I entered 1 or 2 or 8.

    Up to this point the correct records are selected.

    3. I also want to include records where the field [PayID2] is = 1 or 2 or 8.

    When using only criteria 1, there are 25 records selected.
    When using 1 and 2, there are 15 records selected
    When using 1 and 3, there is 1 record selected.

    I can

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select query (2000 SR-1)

    Enter the third condition not on the same line than the second condition but 1 line below.
    Copy the first condition also on the second line in the same column. This condition has to be on the two lines.
    Francois

  3. #3
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select query (2000 SR-1)

    Thanks for the repIy but I am still confused.
    In the RentPaidDate column on the "criteria" line I entered the 1st condition
    In the PayID column on the "criteria" line, I entered the 2nd condition
    In the PayID2 column on the "or" line, I entered the 3rd condition.
    The results returned the 16 records I needed but also included 6 records that were outside of the date range in condition 1.

    Any suggestions?

  4. #4
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Select query (2000 SR-1)

    What happens if you put the PayID2 criteria on the same line as the others, that is, on the criteria line? Could you post the database?
    Regards,

    Gary
    (It's been a while!)

  5. #5
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select query (2000 SR-1)

    On the same line as in third condition, you should enter the first condition also.
    This would look like this:
    <pre>RentPaidDate | PayID | PayID2
    Between [ReportBeg] and [ReportEnd] | 1,2,8 |
    Between [ReportBeg] and [ReportEnd] | | 1,2,8</pre>

    Francois

  6. #6
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select query (2000 SR-1)

    Many thanks! Works like a charm.

    Tom

  7. #7
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select query (2000 SR-1)

    By putting all 3 on the same criteria line, it only selects records that meet all three conditions. See Francois' solution. Thanks for your reply.

    Tom

Posting Permissions

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