将非数字条目拒绝到字段中

问题描述:

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


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 | 行号