检查文本日期并在必要时进行更改 [英] checking text date and changing if necessary

查看:102
本文介绍了检查文本日期并在必要时进行更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检查输入日期,例如01/10/492并能够识别它是不正确的日期,然后在该位置输入默认日期。我已阅读并尝试了一些内容,目前正在尝试这个。

My need is to check an input date, like 01/10/492 and be able to recognize it is not correct date, and then enter a default date in that location. I have read and tried a few things, and am presently trying this

展开 | 选择 | Wrap | 行号

推荐答案

肯。


我很不确定甚至可能在表情内发现错误。

我想建议你做通过VBA。


只需在公共代码模块中编写以下简单函数:
Hi, Ken.

I''m very unsure it is even possible to catch an error within expression.
I would like to recommend you to do it via VBA.

Just write the following simple function in a public code module:
展开 | 选择 | Wrap | 行号



我需要检查一个输入日期,如01/10/492,并能够识别它是不正确的日期,然后在该位置输入默认日期。我已经阅读并尝试了一些事情,现在正在尝试这个


(代码)

IIf(DateValue([Field2])= [#error] ,01/01 / 1990,[field2])

(/ CODE)


如果日期值函数返回错误的想法是,(它在我的查询中显示#error作为返回,),然后我将输入默认日期,如果不是,则使用false参数保持相同的数据。


感谢您的帮助,我正在寻找一个用户组,因为我想学习,但我很难找到阅读。


Ken
My need is to check an input date, like 01/10/492 and be able to recognize it is not correct date, and then enter a default date in that location. I have read and tried a few things, and am presently trying this

(CODE)
IIf(DateValue([Field2])=[#error],"01/01/1990",[field2])
(/CODE)

the idea being if the datevalue function returned error, (it shows #error as return on my query, ) , then I would enter default date, and if not would maintain the same data by using the false argument.

Thank you for any help, I am looking for a user group, cause I want to learn but I am finding the reading very hard.

Ken

如果输入值正在输入名为txtDate的表单字段,然后:

If the Input Value is being entered into a Form Field named txtDate, then:

展开 | 选择 | Wrap | 行号



Ken。


我很不确定它是不是甚至可以在表达式中捕获错误。

我想建议你通过VBA来做。


只需在公共场合写下以下简单函数代码模块:
Hi, Ken.

I''m very unsure it is even possible to catch an error within expression.
I would like to recommend you to do it via VBA.

Just write the following simple function in a public code module:
展开 | 选择 | Wrap | 行号


这篇关于检查文本日期并在必要时进行更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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