Access,如何将姓氏中第一个字母的小写字母更改为大写字母

Access, How can I change lowercase letter of first letter in last name to uppercase

我想使用代码

将姓氏中第一个字母的小写字母更改为大写字母

我的表单代码是:

选项比较数据库

私人订阅 Text19_Click()

Text19 = UCase(Text19)

结束子

但是我的table没有任何变化!

此外,如何找到带有 space、逗号或句点的姓氏,并使其不带 space、逗号和句点。

比如

月亮,

月亮。

[space]月亮

将它们更改为

月亮

如果你的table没有变化,可能你的字段没有绑定到记录集?也许您需要 'Refresh' 您的表格。

此外,您似乎正试图在 TextBox 上使用此代码? 代码如下:

Private Sub Text19_DblClick(Cancel As Integer)
Text19 = Trim(Text19) ' Get rid of leading and trailing spaces.
If right(Text19, 1) = "." Or right(Text19, 1) = "," Then ' Remove comma, period
    Text19 = left(Text19, Len(Text19) - 1)
End If
Text19 = UCase(left(Text19, 1)) & Mid(Text19, 2)
End Sub