I have a data type field (date/time) "SubDate" that contains information in the following format mm/dd/yyyy time or for example: 5/7/2008 1:42:33 PM. My search page pulls out the years (yyyy) from the SubDate field.
Now I want to pull up all data that contains the specific year selected in the search page. For example, if I selected 2010, then the results page will display all of SubDate's data that contain the year 2010 in it.
As of right now, here is my Select statement:
SELECT * FROM district WHERE SubDate = #"&Request.QueryString("SubDateYear")&"# ORDER BY SubDate DESC
And I receive the following error message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query expression 'SubDate = ##'.
Obviously, it is looking only for the year when the field contains 5/7/2008 1:42:33 PM in it.
Any suggestions or recommendations is greatly appreciated.