Microsoft Office Tutorials and References
In Depth Information
Writing Decision-Making Expressions
Using the Access Text functions
Access provides several functions for working with text. You find them in
the Text category in the middle column of Expression Builder. In this
section, we focus on some of the most commonly used functions and show
examples of their use. (For information on more Text functions and
additional details, click the Help button in Expression Builder.)
Table 2-6 lists common Text functions.
Table 2-6
Examples of Built-In Text Functions
Function and Syntax
Returns
Example
LCase( string )
string converted
to lowercase
LCase(“AbCdEfG”)
returns abcdefg .
UCase( string )
string converted
to uppercase
UCase(“AbCdEfG”)
returns ABCDEFG .
Left( string n)
Leftmost n
characters of string
Left(“abcdefg”,3)
returns abc .
Right( string n)
Rightmost n
characters of string
Right(“abcdefg”,2)
returns fg .
Book III
Chapter 2
Mid( string ,
start [,
length ])
Middle length
characters of string
starting at start
Mid(“abcmnyz”,4,2)
returns mn.
Len( string )
Length of string
Len(“Howdy”) returns 5 .
Trim( string )
string with any
leading and trailing
spaces trimmed off
Trim(“ abc ) returns
abc .
InStr([ start ,]
string1 ,
string2 )
Position of
string2 in
string1 starting
at start
InStr(“abcxdef”,”x”)
returns 4 (because x is
the fourth character in
string1 ).
Writing Decision-Making Expressions
One of the most useful functions in Access is the Immediate If function,
IIf(), which accepts three arguments:
IIf( conditionalExpression , doThis , elseDoThis )
Search JabSto ::




Custom Search