为什么此代码在日期访问时不起作用 [英] why this code not work in access on Date

查看:111
本文介绍了为什么此代码在日期访问时不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi





i有两个表访问我想根据日期选择值,现在我写这段代码:



hi


i have two table in access I want to select values ​​based on date, now i write this code:

SELECT tblFishBank.CodeFish, tblFishBank.Mablagh, tblFishBank.SDate, tblFishBank.MDate, tblFishBank.Dis, tblProjeh.fldName, tblProjeh.fldFamil, tblFishBank.InsertDate, tblFishBank.InsertDate
FROM tblProjeh INNER JOIN tblFishBank ON tblProjeh.CodeProj = tblFishBank.CodeProj
WHERE (((tblFishBank.InsertDate)>=#8/20/2014#) AND ((tblFishBank.InsertDate)<=#8/21/2014#));







但是当我运行此代码时。没有结果,但当我删除这段代码时:




But when I run this code. No results, But when I remove this section of code:

WHERE (((tblFishBank.InsertDate)>=#8/20/2014#) AND ((tblFishBank.InsertDate)<=#8/21/2014#));







结果返回





如何更正在两个日期之间返回结果的代码?我使用access




The result returned


How do I correct this code that returns a result between two dates? i use access

推荐答案

我猜你的参数值不是正确的日期时间格式。

尝试替换为:



I would guess your parameter value is not in the right datetime format.
try replacing with:

WHERE tblFishBank.InsertDate between '20140820' and '20140822'


试试这个

Try this
WHERE (((tblFishBank.InsertDate)>='8/20/2014') AND ((tblFishBank.InsertDate)<='8/21/2014'));


所有坦克



i尝试这个并且工作



tanks for all

i try this and work

WHERE (((tblFishBank.InsertDate)>#8/20/2014#) AND ((tblFishBank.InsertDate)< #8/22/2014#));





i replacement> = with>和日期2014年8月21日至2014年8月22日我添加了一天的日期



i replacing >= with > and date 8/21/2014 to 8/22/2014 i added one day to date


这篇关于为什么此代码在日期访问时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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