Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Name Forname validation 1

Status
Not open for further replies.

matrixknow

IS-IT--Management
May 3, 2007
78
What is the function to check, validate or convert the writing of a Name and Forname on input of the user. They should start with a Capital (UCASE) and the following should be in lowercase (LCASE).

example "Marky Ramones"

 
You can use StrConv with vbProperCase. Be aware that DeLacey will be converted to Delacey.
 
You could use the StrConv function and set to vbProperCase. You could add this to the AfterUpdate Event of the control

i.e.

Code:
Private Sub Text1_AfterUpdate()

 ChangeCase

End Sub

Sub ChangeCase()
Screen.ActiveControl = StrConv(Screen.ActiveControl, vbProperCase)
End Sub




If you make something idiot proof - They'll Only make a better idiot!!!
 
Not only will the code as suggested by both Remou and Mike14081972 turn DeLacey into Delacey, but it'll also mess up the names belonging to those denizens of the British Isles such as O'Brien, O'Leary, McLeod and McTavish, anyone having a suffix in their names, such as Jr, Sr or III, as well as hyphenated names such as Zeta-Jones. While DeLacey can only be parsed correctly if entered in the original manner of De Lacey, the others mentioned above can be rendered correctly with the following functions, curtesy of Jay Holovacs, Dev Ashish & Arvin Meyer, found at the following link:


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
I think that the link posted by missinglinq may have problems with Macken and the Irish Fitz. :)
 
Remou . . .

The link provided by [blue]missinglinq[/blue] is [purple]open to additional name formats that can be added[/purple]. All in all an excellent reference . . . [blue]now in my library![/blue] [thumbsup2]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
missinglinq . . .

[blue]Excellent Reference![/blue] . . . worth a pinky!

It doesn't cover them all, but according to the code . . . can be made to do so! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Yes, I believe it could be modified, Aceman1! I think Holovacs, Ashish and Meyer did a stellar job with this hack!


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
My point is that there are a vast number of exceptions to any rule for names, so no matter how good the code, the user will always have to confirm any case conversion. Consider:

DeLacey
De Lacy
de Lacy
Delaney
de la Vega

Not to mention accents: Ó hUigín.
 

As well as C-3PO! You're absolutely correct, of course! The only truly comprehensive way would be what She Who Must Be Obeyed would call the Sister Mary Margaret Method of Data Validation! You stand, looking over the end user's shoulder, and give their knuckles a rap with a steel ruler when they enter data incorrectly! As Aceman1 pointed out, the code can be modified, if need be. And, of course, people are so funny about names! I actually knew a couple named Delacey/De Lacey a number of years ago. He wrote his name DeLacey and she wrote her name De Lacey!

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top