将非数字条目拒绝到字段中 [英] Rejecting non numerical entries into a field

查看:66
本文介绍了将非数字条目拒绝到字段中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这有望将非数字条目拒绝到字段中,并写出类似输入数字。任何帮助将非常感激。提前致谢。


Private Sub Text32_beforeupdate(取消为整数)

如果IsNumeric(Text32.Text)= False那么

我![Text32] ="输入一个数字

否则:结束如果


结束Sub

This would hopefully reject non numerical entries into a field, and write something like " Enter A Number". Any help would be really appreciated. Thanks in Advance.


Private Sub Text32_beforeupdate(Cancel As Integer)
If IsNumeric(Text32.Text) = False Then
Me![Text32] = "Enter a Number"
Else: End If

End Sub

推荐答案


这有望将非数字条目拒绝到一个字段中,并写出类似输入数字。任何帮助将非常感激。提前致谢。


Private Sub Text32_beforeupdate(取消为整数)

如果IsNumeric(Text32.Text)= False那么

我![Text32] ="输入一个数字

否则:结束如果


结束子
This would hopefully reject non numerical entries into a field, and write something like " Enter A Number". Any help would be really appreciated. Thanks in Advance.


Private Sub Text32_beforeupdate(Cancel As Integer)
If IsNumeric(Text32.Text) = False Then
Me![Text32] = "Enter a Number"
Else: End If

End Sub



只需将字段的数据类型设置为数字。

Just set the data type of the field to numeric.



只需将字段的数据类型设置为数字。
Just set the data type of the field to numeric.



我刚刚回到这个问题,感谢您的回复。将数据类型设置为数字对于此任务来说是一个很好的解决方案,但并不理想。我改变了它,现在它做我想要的,除了它给我ERROR 2115(BeforeUpdate或Valuation Rule属性设置阻止保存数据)。在此先感谢您的帮助。


Private Sub Text32_beforeupdate(取消为整数)

如果IsNumeric(Text32.Text)= False那么

Text32.Text =" any

否则:结束如果

End Sub


试试这个相反

Try this instead

展开 | 选择 | Wrap | 行号


这篇关于将非数字条目拒绝到字段中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆