VBProperCase with double barreled surnames??

mr_sd

Registered User.
Local time
Today, 09:35
Joined
May 11, 2004
Messages
24
I have a line of code in an afterupdate sub for my "surname" field:

The code:
Me.PartyName = StrConv(Me.PartyName, vbProperCase)

The problem is when a double barreled surname is entered eg:
Smith-Jones

The code converts it to:
Smith-jones.

Is there a simple way to correct this?

Thanks,
Rich.
 
if you use instr to find "-" and then proper case the two names and rejoin, that will work
 
Me.PartyName = StrConv(Left(Me.PartyName, InStr(Me.PartyName, "-")), vbProperCase) & StrConv(Mid(Me.PartyName, InStr(Me.PartyName, "-") + 1, 50), vbProperCase)
 
Genius!!

Never would have thought of that.

Thanks very much! :D
 

Users who are viewing this thread

Back
Top Bottom