Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005

    Unanswered: Query: selecting values based on criteria

    I have a table where I keep data for multiple hotels where I hae the following rows

    - Year
    - month
    - country of origin
    - nationality criteria - this field has only 2 options, "f" for foreign and "d" for domestic
    - hotel
    - number of guests
    - number of nightings

    I made a query that returns all values based on year, month and object.

    I want to single out all values in the [number of guests] and [number of nightings] that have the value "d" in the nationality criteria, and to have them sorted under same criteria as mentioned above (year,month,object etc.)

    I used the following syntax: DLookUp("[guests]";"[guest_stat]";"[nationality_criteria] = 'd'").

    As a result I get the same single value in all rows.

    any other way of doing it, or am I doing something wrong?


  2. #2
    Join Date
    Aug 2002
    Northampton, England
    Just add "D" in the criteria for your Nationality field. By the way, you should have just one date field instead of Year and month!

    SELECT tblHotels.Nationality_criteria, tblHotels.NoOfGuests, tblHotels.NoOfNightings
    FROM tblHotels
    WHERE (((tblHotels.Nationality)="d"));

Posting Permissions

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