Click here to Skip to main content
15,891,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi


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

SQL
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:
SQL
WHERE (((tblFishBank.InsertDate)>=#8/20/2014#) AND ((tblFishBank.InsertDate)<=#8/21/2014#));



The result returned


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

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

WHERE tblFishBank.InsertDate between '20140820' and '20140822'
 
Share this answer
 
Try this
SQL
WHERE (((tblFishBank.InsertDate)>='8/20/2014') AND ((tblFishBank.InsertDate)<='8/21/2014'));
 
Share this answer
 
tanks for all

i try this and work

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


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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900