sql query syntax
Posted on 2006-11-15
We have an application that makes a selection from a Access database based on on date that is passed in. For example if we pass in 10/26/2006, it would select all items that match that month in a date field. This has been working great, but for some reason when it comes to December/January, those 2 months pull up the same data.
Here is the statement that has been used to date:
SQL = "SELECT * FROM tbl_cm_schedule WHERE cid=" & Session.Contents("UserID") & " AND (DATEDIFF('m',#" & dDate & "# , cdate) = DATEDIFF('yyyy', #" & dDate & "#, cdate)) ORDER BY cdate"
So if you're viewing data in December, you see both December and January data, and in January you see both Jan. and Dec. data.
Any help is appreciated.