The information in this article applies to:
Novice: Requires knowledge of the user interface on single-user computers. This article applies to a Microsoft Access database (.mdb) and a Microsoft Access project (.adp). SUMMARYYou can sort or group a query or stored procedure by using only a portion of a field's value. This technique is useful if a field contains values with a set number of leading or trailing characters that are insignificant to your sorting task. An example of this might be a part number field that contained the following values: A-453-34567 MORE INFORMATIONIn a Microsoft Access Database (.mdb)To demonstrate how to sort or group a query by using only a portion of a field's value, this article uses the sample database Northwind.mdb to create a query based on the Employees table. The query uses the Mid() function to sort by six characters beginning with the fourth character in the LastName field. You could also use the Left() and Right() functions to return characters from the left or from the right side of a string argument. The following procedure explains how to use the Mid() function to sort data by using only a portion of a field's value:
Sort String: Mid([LastName],4,6) A-453-34567you could sort these part numbers by the third through fifth characters only by using the following expression: Expr1: Mid([PartNo]),3,3) In a Microsoft Access Project (.adp)To demonstrate how to sort or group a stored procedure by using only a portion of a field's value, this article uses the sample project NorthwindCS.adp to create a stored procedure based on the Employees table. The stored procedure uses the SubString() function to sort by six characters beginning with the fourth character in the LastName field. You could also use the Left() and Right() functions to return characters from the left or from the right side of a string argument.
REFERENCESFor more information about string expressions, click Microsoft Access Help on the
Help menu, type examples of expressions in the Office Assistant or
the Answer Wizard, and then click Search to view the topics
returned. Additional query words:
Keywords : kbdta QryHowto |
Last Reviewed: November 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |