ACC1x: Queries Sort by Order of IN() Parameters

ID: Q92689


The information in this article applies to:


SUMMARY

If you use the IN() operator in an unsorted query, the output will be grouped on the associated field. In addition, Microsoft Access will place the groups in the same order as the parameters are listed in the IN() operator.


MORE INFORMATION

Steps to Reproduce Behavior


  1. Create a table with Firstname and Lastname fields (data type "text"). Enter the data listed below:

    JOE SMITH
    JANE DOE
    ABE LINCOLN
    JOHN DOE


  2. Create a query on this table. In the Criteria cell for Lastname, type:

    IN("LINCOLN","DOE")

    The query will generate these records:

    ABE LINCOLN
    JANE DOE
    JOHN DOE


You can have the records appear in a different sequence by changing the order of the parameters in the IN() operator, or you can explicitly specify a SORT order.

Additional query words: sorting group in order by


Keywords          : kbusage QryOthr 
Version           : 1.0 1.1
Platform          : WINDOWS 
Issue type        : kbinfo 

Last Reviewed: March 12, 1999