在 MS Access 中禁用多行字段 [英] Disabling multi-line fields in MS Access
本文介绍了在 MS Access 中禁用多行字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法禁止在文本框中输入多行条目(即,我想阻止我的用户按 ctrl-enter 来获取换行符)?
Is there a way to disable entering multi-line entries in a Text Box (i.e., I'd like to stop my users from doing ctrl-enter to get a newline)?
推荐答案
我能够使用 KeyPress 事件来做到这一点.下面是代码示例:
I was able to do it on using KeyPress event. Here's the code example:
Private Sub SingleLineTextBox_ KeyPress(ByRef KeyAscii As Integer)
If KeyAscii = 10 _
or KeyAscii = 13 Then
'10 -> Ctrl-Enter. AKA ^J or ctrl-j
'13 -> Enter. AKA ^M or ctrl-m
KeyAscii = 0 'clear the the KeyPress
End If
End Sub
这篇关于在 MS Access 中禁用多行字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文