02-12-2005, 09:18 PM | #1 (permalink) |
Junkie
Location: Classified
|
[MS Access] Proper case with "Mc" names
I have customer data I've imported into Access, and one of my Update queries converts the person's last name to proper case (so that SMITH becomes Smith, for example.)
In the "Update To:" part of the grid for this field, I have this function: StrConv([LastName],3) The problem is when Access encounters a "Mc" name, such as "MCCLOSKEY". The StrConv function gives me "Mccloskey", but I would like "McCloskey". Has anyone else done this? Please? I tried using the Expression Builder to make a function that looks at the first two letters of the last name, so that if it is "MC", then concatenate "Mc" & the Proper case of the rest of the characters in the string -- "Closkey." Maybe I built it wrong, but I think such a thing is possible. |
02-13-2005, 07:00 AM | #3 (permalink) |
Getting it.
Super Moderator
Location: Lion City
|
It has been a while since I played with access but couldn't you do a filter for all instances of "cc" and then find and replace the "cc" with "cC"...
Just a thought.
__________________
"My hands are on fire. Hands are on fire. Ain't got no more time for all you charlatans and liars." - Old Man Luedecke |
02-14-2005, 07:04 AM | #5 (permalink) |
Guest
|
Write your own function - this one should do the job:
Code:
Function McStrConv(expr As Variant) As String Dim ThirdChar As String McStrConv = StrConv(expr, 3) If Left(McStrConv, 2) = "Mc" And Len(McStrConv) > 2 Then ThirdChar = UCase(Mid(McStrConv, 3, 1)) McStrConv = "Mc" & ThirdChar & Right(McStrConv, Len(McStrConv) - 3) End If End Function |
Tags |
access, case, names, proper |
|
|