不允许使用“,”在输入小时表单字段中。 [英] Not Allow a "," in a input hours Form field.
本文介绍了不允许使用“,”在输入小时表单字段中。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
早上好。
我有一个用户输入小时的表单,并且舍入功能和一切正常,除非用户键入1,25而不是1.25,小时跳到125.00而不是1.25。有一个简单的解决方案吗?或者也许我可以在VBA中抛出一个声明,不允许用户输入它?
如果有人需要代码,请告诉我。
我感谢您的时间和帮助,因为我是Access的新手。
Mark
Good Morning.
I have a form where users are inputting hours, and the rounding function and everything works correctly, except when a user types 1,25 instead of 1.25, the hours jump to 125.00 instead of 1.25. Is there an easy fix? Or perhaps a statement I can throw in VBA to not accommodate for users to enter that in?
If anyone needs the code, let me know.
I appreciate your time and assistance, as I am new to Access.
Mark
推荐答案
有几个实现这一目标的方法。让我们假设在表单上包含这些值的Control是一个名为txtValue的文本框。在txtValue的AfterUpdate()事件中,您可以放置一行代码,该代码行将转换任何,, in the value to a。
There are several ways to accomplish this. Let''s suppose the Control containing these Values on your Form is a Text Box named txtValue. In the AfterUpdate() Event of txtValue you can place a single Line of Code that will convert any "," in the Value to a ".".
展开 | 选择 | Wrap | 行号
在控件的BeforeUpdate事件中,输入以下内容代码(我假设控件名为txtHours):
In the control''s BeforeUpdate event, enter the following code (I will assume a control name of txtHours):
展开 | 选择 | Wrap | 行号
我的想法可能不如你的任何一个好。我做了一些研究,想到了禁止某人进入KeyAscii of 44(逗号)的想法。那可能吗?我不想将任何值设置为0,因为除了千分之一的占位符问题之外,代码也是如此。我还实现了一些格式作为catch,当值>时将框的颜色更改为红色。 99.
让我知道你们对KeyAscii解决方案的看法以及如何实现它?
我打算尝试
I have an idea that may not be as good as either of yours. I did some research and thought of the idea of prohibiting someone entering the KeyAscii of 44 (a comma). Is that possible? I don''t want to set any values to 0, because as is the code works aside from the thousandths placeholder issue. I also implemented some formatting as a catch, changing the color of the box to red when value > 99.
Let me know what you all think about the KeyAscii solution and how would I implement it?
I was going to try
展开 | 选择 | Wrap | 行号
这篇关于不允许使用“,”在输入小时表单字段中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文