【问题标题】:Input mask in MS Access, uppercase and lowercase lettersMS Access 中的输入掩码,大写和小写字母
【发布时间】:2014-12-14 10:40:33
【问题描述】:

这个“" 将输入文本更改为大写

我的问题是。如何将输入文本更改为正常(大写或小写)
在使用符号 之一之后。

例如 我想创建这样的输入掩码

abcdef(必须小写)AbCdefG(可以大写或小写)

第 6 个 leeter 必须是小写,其余的可以是大写或小写

【问题讨论】:

    标签: ms-access text input mask typing


    【解决方案1】:

    Access 中的输入掩码有点受限。你必须深入到 VBA 才能得到你想要的。

    例如:

    Private Sub txtbox_KeyPress(KeyAscii As Integer)
        ' Convert the typed key to upper case
        KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
    
        ' Only Allow user to type letters A-E and 1-6
        If KeyAscii >= 32 Then
            If InStr(1, "ABCDE123456", Chr$(KeyAscii), 1) = 0 Then
                KeyAscii = 0
            End If
            ' Stop the input after the user typed 5 characters
            If Len(txtbox.Text) = 5 Then KeyAscii = 0
        End If
    End Sub
    

    这将只允许用户在文本框中输入最多 5 个字符。
    只允许使用字符 A 到 E 和数字 1 到 6,并且它们以大写形式输入。

    您需要适应您的具体情况,并可以使用KeyDownKeyPressChange 事件来检测和调整数据输入。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-04
      • 2023-03-30
      • 1970-01-01
      • 2013-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-01
      相关资源
      最近更新 更多