ACC: Applying String Functions to Numeric Data TypesID: Q109708
|
Novice: 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.
The 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 Long
For more information about string functions, search for "Left," "Right," "Mid," or "Trim" using the Microsoft Access Help menu.
Keywords : kbusage ExrOthr
Version : 1.0 1.1 2.0 7.0
Platform : WINDOWS
Issue type : kbinfo
Last Reviewed: March 30, 1999