ACC: Applying String Functions to Numeric Data TypesLast reviewed: December 2, 1997Article ID: Q109708 |
The information in this article applies to:
SUMMARYNovice: Requires knowledge of the user interface on single-user computers. When you apply the Left() or Mid() function to a numeric data type that has been converted to a string, you must account for the algebraic sign in the value's leftmost position.
MORE INFORMATIONThe algebraic sign in the leftmost position of an integer value is either a space (for positive numbers) or a minus sign (for negative numbers). Note that if the value is positive, you can use the Trim() function to remove the space. The following list shows what will be returned when string functions such as Left(), Mid(), or Right() are applied to integers:
Function Returns Data Type --------------------------------------------------- Mid$(Str$(1234),1,1) " " String Mid$(Trim(Str$(1234)),1,1) "1" String Mid$(Str$(1234),2,1) "1" String Mid$(Trim(Str$(1234)),2,1) "2" String Mid$(Str$(-1234),1,1) "-" String Mid$(Trim(Str$(-1234)),1,1) "-" String Mid$(Trim(Str$(+1234)),1,1) "1" String Mid$(Trim(Str$(-1234)),1,2) "-1" String Right$(Str$(1234),4) "1234" String Right$(Str$(1234),5) " 1234" String Left$(Str$(1234) ,1) " " String Left$(Trim(Str$(1234)),1) "1" String Left$(Str$(1234),2) " 1" String Left$(Trim(Str$(1234)),2) "12" String Left$(Str$(-1234),1) "-" String Left$(Trim(Str$(-1234)),1) "-" String Left$(Trim(Str$(+1234)),1) "1" String Left$(Trim(Str$(+1234)),2) "-1" String Len(Str$(1234)) 5 Long Len(Trim(Str$(1234))) 4 LongNOTE: The quotation marks in the list above are not returned by the functions. They are used here to help show blank, or space, characters.
REFERENCESFor more information about string functions, search for "Left," "Right," "Mid," or "Trim" using the Microsoft Access Help menu. Keywords : ExrOthr kbusage Version : 1.0 1.1 2.0 7.0 Platform : WINDOWS Hardware : x86 Issue type : kbinfo |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |