验证在Access 2000中不起作用 [英] Validations not working in Access 2000

查看:110
本文介绍了验证在Access 2000中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在表单中包含一些验证(带验证文本),但我似乎无法让它工作。我目前正在使用Access 2000格式的数据库,但我在2003年和2007年尝试过没有更好的结果。


我需要一个字段的日期等于或小于比另一个日期字段。


我输入的验证是< = [cboStartDate],我有相应的验证文本,但是当我测试表单时,它接受了无效的条目并且没有给出任何错误消息。


我认为问题是因为我使用日历控件来插入日期,因为当我手动输入日期时,验证工作。


有没有办法让这条规则在不放弃日历控制的情况下工作?


谢谢!

I have been trying to include some validation (w/ validation text) in my forms but I cant seem to get it to work. I''m currently using a DB in Access 2000 format, but I tried it in 2003 and 2007 with no better results.

I need the date of one field to be equal or less than another date field.

The validation I entered was <=[cboStartDate] and I had corresponding validation text, but when I tested the form it accepted the invalid entry and gave no error message.

I think the problem is because I am using a calendar control to insert the date, because when I manually type the date in, the validation works.

Is there a way to get this rule to work without giving up the calendar control?

Thanks!

推荐答案


我一直试图在我的表单中包含一些验证(带验证文本),但我似乎无法让它工作。我目前正在使用Access 2000格式的数据库,但我在2003年和2007年尝试过没有更好的结果。


我需要一个字段的日期等于或小于比另一个日期字段。


我输入的验证是< = [cboStartDate],我有相应的验证文本,但是当我测试表单时,它接受了无效的条目并且没有给出任何错误消息。


我认为问题是因为我使用日历控件来插入日期,因为当我手动输入日期时,验证工作。


有没有办法让这条规则在不放弃日历控制的情况下工作?


谢谢!
I have been trying to include some validation (w/ validation text) in my forms but I cant seem to get it to work. I''m currently using a DB in Access 2000 format, but I tried it in 2003 and 2007 with no better results.

I need the date of one field to be equal or less than another date field.

The validation I entered was <=[cboStartDate] and I had corresponding validation text, but when I tested the form it accepted the invalid entry and gave no error message.

I think the problem is because I am using a calendar control to insert the date, because when I manually type the date in, the validation works.

Is there a way to get this rule to work without giving up the calendar control?

Thanks!



嗨。如果您正在测试未绑定到基础日期字段的组合框的值,则显示的日期实际上是日期的文本表示形式,而不是日期值。 (日期实际上在内部表示为数值。)您可以通过使用CDate函数将组合值显式转换为日期来使您的比较工作:

Hi. If you are testing the value of a combo box which is not bound to an underlying date field the date shown is really a text representation of a date, not a date value. (Dates are actually represented as numeric values internally.) You can get your comparison to work by explicitly converting the combo value to a date using the CDate function:

展开 | 选择 | Wrap | 行号


谢谢Stewart,


我刚尝试过。它没有用。


我不完全确定,但我认为日期字段*是*绑定到基础日期字段。


以下是代码(有几个控件使用相同的日历):

Thanks Stewart,

I just tried it. It didnt work.

I''m not entirely sure, but i think the date field *is* bound to an underlying date field.

Here is the code (there are several controls using the same calendar):

展开 | 选择 | Wrap | 行号


再次嗨。嗯,乍一看,使用日历控件似乎都可以。绑定控件已经为它们绑定的字段执行隐式类型转换,这就是我在第一个回复中提到了未绑定控件的原因。你可以粘贴你正在进行比较的查询的SQL,这样我就可以看到你在完全比较的内容了吗?


谢谢


Stewart
Hi again. Well, at first glance all seems OK with the use of the calendar control. Bound controls already do an implicit type conversion for the field to which they are bound, which is why I mentioned an unbound control in my first reply. Could you paste the SQL of your query in which you are performing the comparison so that I can see what you are comparing in full?

Thanks

Stewart


这篇关于验证在Access 2000中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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