Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to retrieve data from my access table based on Date column. My requirement is to display everything greater than the certain value. I am trying to cast my value, which is a string using Format &CDate function with datetime data type and it throws out as Overflow.

Here's query :

Select * from Events
Where Events.[Date] > cDate(Format("20130423014854","yyyy-MM-dd hh:mm:ss"))

Sample Date Record Value from Table : 2013-04-23 13:48:54.0

Events.[Date] is a Date/Time type field in access

How can I fix this ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
659 views
Welcome To Ask or Share your Answers For Others

1 Answer

Use the DateValue() function to convert a string to date data type. That's the easiest way of doing this.

DateValue(String Date) 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...