Capitalize first two letters in a field

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?
 
J

John Spencer

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
'====================================================
 
S

Stefan Hoffmann

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 <--
 
P

Paolo

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
 
J

John Spencer

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
'====================================================
 

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