如何替换“您输入的值无效”使用自定义消息 [英] How to replace "the value you entered isn't valid" with a custom message

查看:243
本文介绍了如何替换“您输入的值无效”使用自定义消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以阻止此消息显示?


我有几个未绑定的文本框我想用作开始日期/结束日期类型参数的过滤器。我想使用内置日历选项让用户选择日期(以及能够输入日期),因此我将文本框的格式设置为短日期。然而,在这样做时,这意味着这个无效值。现在,当日期格式错误时弹出消息,而不是LostFocus事件我必须检查日期格式并提醒用户。


任何想法是否可以隐藏/禁用这些消息?它会以类似的方式与DoCmd.SetWarnings False / True?


谢谢。


Adam。

Is it possible to stop this message from appearing?

I''ve got a couple of unbound textboxes that I want to use as filters for start date/end date type parameters. I wanted to use the build-in calendar option to let users select a date (as well as being able to type it in) so I set the format of the text boxes to Short Date. However in doing this it means that this "invalid value" message now pops up when the date format is wrong, as opposed to the LostFocus event I had to check the date format and alert the user.

Any idea if it''s possible to hide/disable these kinds of messages? Would it be in a similar way to DoCmd.SetWarnings False/True?

Thanks.

Adam.

推荐答案

您可以查看自定义错误消息,但我不认为这是你最好的方法。正如您所需要的那样,您可以期待使用一个繁琐的解决方案。我将清除条目(事件)上TextBox控件的任何格式,并在输入值后再次确定更新(事件)。这样你在输入数据时就不会被格式限制。
You could check out Custom Error Messages, but I don''t think this is your best approach. As what you require is a little unusual you can expect to use a fiddly solution. Mine would be to clear any format of the TextBox control on Entry (the event), and determine it again After Update (event) by the value entered. That way you wouldn''t be constrained by the Format while entering data.


Jeez Neo,你很快就抽奖了。




亚当,如果你想去自定义错误信息然后捕获错误号并显示与该号码相关的自定义消息

Jeez Neo, you''re quick on the draw :)



Adam if you want to go the "Custom Error Message" way then catch the error number and display a custom message in relation to that number

展开 | 选择 | Wrap | 行号


嗯是的我不要认为这种方法会起作用 - 这似乎是基于使用运行时错误代码,而这并不是一个。

我使用格式的原因是因为它似乎除非有另一种方式,否则是获取文本框日历的最简洁方法? (除了建立日历表格)
Mmm yeah I don''t think that approach would work - that seems to be based around using the run time error codes, whereas this doesn''t have one.
The reason I used format was because it seems to be the cleanest way to get a calendar for the text boxes, unless there''s another way? (aside from building a calendar form)


这篇关于如何替换“您输入的值无效”使用自定义消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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