I am using Access 2010 as a front-end to a database on SQL Server 2008. I have a date field which is stored as a nvarchar(50). I have the following value in the text field DateHr 12/04/11 16:49:23 , which should translate to April 11, 2012 4:49 PM (As is the date and time the record was created.).
I cannot change the datatype of the field to DateTime as it messes up the dates even more (Ex. 12/4/2011 4:49:23 PM). I cannot change the way the record is entered.
I need to display this field in the format “mm/dd/yy” and be able to do where clause in this format.
I have tried the following just to see if it displaying correctly but dtDate is displaying 11/12/04:
Select (Format(CDate([DateHr]),"yy/mm/dd")) as dtDate
Create a SQL Server view to expand the year component of the date text to 4 digits. Then
SELECT CDate([DateHr]) AS dtDate FROM YourViewshould work from the Access side. However it might be better still to have the view cast the date text to an actual date type … then you could use it directly from Access without the need forCDate().