ACC: Sample Function to Format NamesLast reviewed: August 28, 1997Article ID: Q149953 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. This article lists a sample function that you can use in Microsoft Access to concatenate portions of text fields. The function is useful in displaying names in various formats on forms and reports. This function can be used as a control source in a text box on either a form or report, or as an expression in a query. This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual. NOTE: Visual Basic for Applications is called Access Basic in Microsoft Access version 2.0. For more information about Access Basic, please refer to the "Building Applications" manual.
MORE INFORMATIONNOTE: In the following sample code, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic. Open any database in Microsoft Access and follow these steps to create the NFORMAT() function:
NFormat([First],[Middle],[Last],[Style]) Where Displays [Style]=0 Nancy Anne Davolio [Style]=1 Nancy A. Davolio [Style]=2 N. A. Davolio [Style]=3 Davolio, Nancy Anne [Style]=4 Davolio, Nancy A. [Style]=5 Davolio, N. A. [Style]=6 Nancy Davolio [Style]=7 Nancy D. [Style]=8 Davolio, Nancy [Style]=9 Davolio, N. [Style]=10 N. A. D. [Style]=11 N. D.If you use an invalid style, the procedure returns an empty string ("").
|
Additional query words: how to
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |