多个标准DCount - 日期问题 [英] Multiple Criteria DCount - Date problem

查看:59
本文介绍了多个标准DCount - 日期问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有以下代码无法正常工作:

Hi,

I have the following code that doesn''t work:

展开 | 选择 | Wrap | 行号

推荐答案

我不能立即发现任何错误,因此它可能与您表/表格中的数据有关。在大多数情况下,你有一个长字符串连接,特别是那些带有表单字段的情况,最好的调试方法是:
I dont immediatly spot anything wrong, so it may be related to the data you have in your table/form. In most cases where you have a long string concatation, especially those with form fields, the best way to debug is to do:
展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


你在意大利的Doma,所以有可能你的日期显示的默认格式甚至不被Jet SQL识别。严格地说,当在SQL字符串中用作文字时,日期值应始终格式化为m / d / yyyy。有关更多信息,请参见文字日期时间及其分隔符(#)在此。
You''re in Italy Doma, so the chances are the default format for your dates displaying is not even recognised by Jet SQL. Strictly speaking, date values should always be formatted as m/d/yyyy when used as literals in a SQL string. See Literal DateTimes and Their Delimiters (#) for more on this.


Smiley,tnx代码。它可能在将来有用。

问题在于日期格式。

我已经格式化了ReportDate的数据类型。数据库中的字段为m / d / yyyy。我还将控制属性中的日期控制格式化为m / d / yyyy。问题仍然存在,我仍然会得到相同的错误消息,相同的sql字符串。 Access会识别字段中的所有值,但会说语法有问题,特别是指日期控制。

虽然我将格式更改为m / d / yyyy,但是在sql字符串中错误地它仍然会被写成''dmyyyy。''

之后,我已经将Windows日期设置更改为am / d / yyyy格式,之后代码立即生效。


问题是我仍然需要找到编写代码的方法,这样它就不依赖于用户的窗口设置。

NeoPA,I我们已经看过你提供的链接了,但是我仍然想弄清楚如何让它在胜利设置上不可靠。
Smiley, tnx for the code. It might be useful in the future.
The problem was with date format.
I''ve formated data type of the "ReportDate" field in the database to m/d/yyyy. I''ve also formated the date control in control properties to m/d/yyyy. The problem was still there, I would still get the same error message, same sql string. Access would recognize all the values in the fields but it would say that there is a problem with syntax, especially referring to date control.
Although I changed the formats to m/d/yyyy, in sql string in error it would still be written ''d.m.yyyy.''
After that, I''ve changed the Windows date settings into a m/d/yyyy format, after which the code worked immediately.

The problem is that I still need to find the way to write the code so that it doesn''t depend on users windows settings.
NeoPA, I''ve took a look on the link you provided, but I''m still trying to figure out how to make it work undependable on win settings.


这篇关于多个标准DCount - 日期问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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