How to determine if field is all uppercase?

M

majobojrod

I know how to convert fields to all uppercase, all lowercase, or to mixed
case, but how can you determine if a field is all uppercase, or all lowercase?
 
A

Allen Browne

Type an expression like this into the Field Row in query design,
substituting your field name for f1:

IsUpper: IIf([f1] Is Null, Null, StrComp(StrConv([f1], 1), [f1], 0) = 0)

If you are trying this in VBA, use IsNull() instead of Is Null, and use
vbUpperCase and vbBinaryCompare for the arguments.
 
J

John Spencer

Couldn't that exprsssion be simplified by removing the IIF? StrComp and
StrConv both handle nulls and if F1 is null the expression below will return
Null

IsUpper: StrComp(StrConv([f1], 1), [f1], 0) = 0

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Allen Browne said:
Type an expression like this into the Field Row in query design,
substituting your field name for f1:

IsUpper: IIf([f1] Is Null, Null, StrComp(StrConv([f1], 1), [f1], 0) = 0)

If you are trying this in VBA, use IsNull() instead of Is Null, and use
vbUpperCase and vbBinaryCompare for the arguments.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

majobojrod said:
I know how to convert fields to all uppercase, all lowercase, or to mixed
case, but how can you determine if a field is all uppercase, or all
lowercase?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top