how to compare date sql select query while access records from database(MS Access)

vb.net , access India
  • 12 years ago
    Hello, I have one sql query in which i comparing the date and search record, but there is problem occurs when i compare date less then current date. i have table(in access):having field name(date) type(varchar) and my query is: "select * from status where date<'"& date.today &"'" it will show wrong result: it compare only day ex: 23/feb/2009<12/mar/2009 result 23 feb 2009 please help thanks
  • 12 years ago
    if you are working with MSAccess enclose the date variable with # sign. e.g. "select * from table1 where dob<#" & today &"#"
  • 12 years ago
    hi.. select * from status where date< cdate('" & date.today & "')" this is gona work 110%... enjoy programming.. SaAd AAli..

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter” - Eric Raymond