Microsoft KB Archive/92689

{|
 * width="100%"|

ACC1x: Queries Sort by Order of IN Parameters

 * }

Q92689

-

The information in this article applies to:


 * Microsoft Access versions 1.0, 1.1

-

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.

Steps to Reproduce Behavior

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

JOE SMITH

JANE DOE

ABE LINCOLN

JOHN DOE
 * 1) Create a query on this table. In the Criteria cell for Lastname, type:

IN(&quot;LINCOLN&quot;,&quot;DOE&quot;)

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

Issue type : kbinfo

Technology :