在where子句中的日期 [英] Dates in where clause

查看:77
本文介绍了在where子句中的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个带有拖曳字段的表格,日期为dd / mm / yyyy格式。我正在尝试使用
中的字段查询''s where子句中的字段如下;


" SELECT *" &安培; _

" FROM Orders" &安培; _

"订单。[交货日期])> =#" &安培;格式([表格]![批次

发票]![FromDate],dd / mm / yyyy)& #和订单。[交货日期]< =#" &

格式([Forms]![Batch Invoices]![ToDate]," dd / mm / yyyy")& #"


我的问题是查询doe snot正确读取日期,而是以mm / dd / yyyy格式获取

,即如果01/07/2006(dd / mm / yyyy)输入,

查询带来07/01/2006(mm / dd / yyyy)的记录。


在这种情况下,处理日期的理想方式是什么,因此查询的日期是

为dd / mm / yyyy?


谢谢


问候

Hi

I have a form with tow fields for dates in dd/mm/yyyy format. I am trying to
use the fields in a query''s where clause as below;

"SELECT * " & _
"FROM Orders " & _
" WHERE Orders.[Delivery Date])>= #" & Format([Forms]![Batch
Invoices]![FromDate], "dd/mm/yyyy") & "# And Orders.[Delivery Date]<= #" &
Format([Forms]![Batch Invoices]![ToDate], "dd/mm/yyyy") & "# "

My problem is that query doe snot read the dates correctly and rather takes
them as in mm/dd/yyyy format i.e. if 01/07/2006 (dd/mm/yyyy) was entered,
query brings records for 07/01/2006 (mm/dd/yyyy).

What is the ideal way to deal with the dates in this case so the dates are
taken as dd/mm/yyyy by the query?

Thanks

Regards

推荐答案

以mm-dd-yyyy格式格式化它们。

format them in mm-dd-yyyy format.


在哪里?我该如何修改where子句?我不能指望用户以非dd / mm / yyyy格式输入日期,因为

语言环境已经习惯了它们。


谢谢


问候

< pi ******** @ hotmail.comwrote in message

新闻:11 ********************** @ m73g2000cwd.googlegr oups.com ...
Where? How should I modify the where clause? I can''t expect the user to
enter date in non-dd/mm/yyyy format as they are all used to it due to the
locale.

Thanks

Regards
<pi********@hotmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...

格式为mm-dd-yyyy格式。
format them in mm-dd-yyyy format.



* John:
* John:




我有一个带有拖曳字段的表格,日期为dd / mm / yyyy格式。我正在尝试使用
中的字段查询''s where子句中的字段如下;


" SELECT *" &安培; _

" FROM Orders" &安培; _

"订单。[交货日期])> =#" &安培;格式([表格]![批次

发票]![FromDate],dd / mm / yyyy)& #和订单。[交货日期]< =#" &

格式([Forms]![Batch Invoices]![ToDate]," dd / mm / yyyy")& #"


我的问题是查询doe snot正确读取日期,而是以mm / dd / yyyy格式获取

,即如果01/07/2006(dd / mm / yyyy)输入,

查询带来07/01/2006(mm / dd / yyyy)的记录。


在这种情况下,处理日期的理想方式是什么,因此查询的日期是

为dd / mm / yyyy?


谢谢


问候

Hi

I have a form with tow fields for dates in dd/mm/yyyy format. I am trying to
use the fields in a query''s where clause as below;

"SELECT * " & _
"FROM Orders " & _
" WHERE Orders.[Delivery Date])>= #" & Format([Forms]![Batch
Invoices]![FromDate], "dd/mm/yyyy") & "# And Orders.[Delivery Date]<= #" &
Format([Forms]![Batch Invoices]![ToDate], "dd/mm/yyyy") & "# "

My problem is that query doe snot read the dates correctly and rather takes
them as in mm/dd/yyyy format i.e. if 01/07/2006 (dd/mm/yyyy) was entered,
query brings records for 07/01/2006 (mm/dd/yyyy).

What is the ideal way to deal with the dates in this case so the dates are
taken as dd/mm/yyyy by the query?

Thanks

Regards



控制是否受约束?如果是这样,那些字段是否被绑定

日期/时间字段或文本字段?


-

Randy Harris

tech at promail dot com

我很确定我知道我能记住的一切。

Are the controls bound? If so, are the fields they''re bound to
Date/Time fields or Text fields?

--
Randy Harris
tech at promail dot com
I''m pretty sure I know everything that I can remember.


这篇关于在where子句中的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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