i can capitalize a word or set of words with
StrConv([ControlName],vbProperCase).
However names like O'Connor are imporperly capitalized.
An obvious solution is a reference table of names which might be subject to
this problem.
Can anyone direct me to such a table? I did this once and it is really
laborious to build, and usually incomplete anyway!
And yes I would allow people to override and to add new entries...
Thanks for any help!
See if this helps.
Watch out for line wrap on the longer lines.
Make a new table.
Field: [ID] AutoNumber Indexed No Duplicates
Field: [ExceptName] Text
TableName: tblExceptions
Enter as many known name exceptions as you can, i.e. McDonald,
O'Brien, van den Steen, Smith-Jones, etc.
====
Paste this function into a new module.
Public Function ConvExceptions(StringIn As String) As String
' Will find exceptions to Proper Case capitalization of names.
On Error Resume Next
If DCount("*", "tblExceptions", "[ExceptName] = " & Chr(34) & StringIn
& Chr(34) & "") > 0 Then
Dim intResponse As Integer
Dim strFind As String
strFind = DLookup("[ExceptName]", "tblExceptions", "[ExceptName] =
" & Chr(34) & StringIn & Chr(34) & "")
intResponse = MsgBox(strFind & vbCrLf & " is an exception name." &
vbCrLf & " Accept the above capitalization? Y/N ?", vbYesNo,
"Exception found!")
If intResponse = vbYes Then
ConvExceptions = strFind
Exit Function
End If
End If
ConvExceptions = StrConv(StringIn, 3)
End Function
======
Use it in a Control's AfterUpdate event:
If Not IsNull([ThisField]) Then
[ThisField] = ConvExceptions([ThisField])
End If
Add new names to the exceptions table as they occur.
Also remember that there are multiple correct capitalizations of
names, O'Connor and O'connor are both correct, depending upon the
individual's choice, and some words can be capitalized or not,
depending upon usage i.e. "The city's main street is Main Street."