Capitalize first two letters in a field

  • Thread starter Thread starter CCripe
  • Start date Start date
C

CCripe

I have a field that will automatically store first initial last name of the
user. I want the data formatted so that the first two letters are always
capitalized.

i.e.

jsmith
JSMITH
etc.

All convert to JSmith

Is this possible?
 
strX = UCase(Left(UserName)) & LCase(Mid(UserName,3))

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
hi,
I have a field that will automatically store first initial last name of the
user. I want the data formatted so that the first two letters are always
capitalized.
Why?

SELECT UCase(Left([FirstName], 1) &
StrConv([LastName], 3)
FROM [yourTable]

jsmith
JSMITH
etc.
All convert to JSmith
Is this possible?

SELECT UCase(Left([yourField], 2)) &
LCase(Mid([yourField], 3, 32768))
FROM [yourTable]


mfG
--> stefan <--
 
Hi John,
you forgot a little thing in your string. I think is more correct in this way

strX = UCase(Left(UserName,2)) & LCase(Mid(UserName,3))

Cheers Paolo
 
I sure did. Thanks for the correction.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
Back
Top