Monday, 7 July 2014

M S Access Date Between Query Not Giving Desired Result

Actualy what I will do here is just show you
Examples of using dates as criteria in Access queries



If I was not wrong you were facing problem in Access Database Query of Between   or >< 
for Dates

Actualy it is not as same as SQL to get record from by just putting between keyword...

MS Access must be filterd from  format('<urdate'>,'dd/mm/yyyy')

but lets first focus what you are facing /what wrong you were doing...

WRONG METHODS
SELECT Purchase_Date, Purchase_Billno
FROM Purchase_Item
where format('Purchase_Date,'dd/mm/yyyy')> '02/01/2014'
and format('Purchase_Date,'dd/mm/yyyy')<'22/12/2014'



or 

 SELECT Purchase_Date, Purchase_Billno
FROM Purchase_Item
where format('Purchase_Date,'dd/mm/yyyy')> #02/01/2014#
and format('Purchase_Date,'dd/mm/yyyy')<#22/12/2014#



RIGHT WAY
Lets See How Its Works..

SELECT Purchase_Date, Purchase_Billno
FROM Purchase_Item
where Purchase_Date> format('02/01/2014','dd/mm/yyyy')
and Purchase_Date< format('22/12/2014','dd/mm/yyyy')



This will show you the exact match of your desired result,
So Hows that solution :)


No comments:

Post a Comment

Print Only Grid View in ASP.net

ASP.net How to Print Only GridView < div id ="gridviewDiv" >   < asp:GridView ID ="gridViewToPri...