date sql

  • Thread starter Thread starter dave
  • Start date Start date
D

dave

Hi
I have one field called start_date...type date/time field...

I want to retrieve all record where start_date <= current date (Current
date-->system's today's date)....

Can any one tell me what should be sql?
I tried with

Sql = "Select * From table1 where start_date <=" & Date

but it didnt return any records...if possible i also want to retrieve
records even start_date is null or start_date <= current date

Thanx
 
Hi,
Try something like this:
Sql = "Select * From table1 where start_date <=#" & Date & "#"
 
Sql = "Select * From table1 where start_date <=" & Date

If you are using a Jet database, this should work:

strSQL = "SELECT * FROM Table1 WHERE Start_Date <= DATE()"

If you are using SQL Server etc, the inbuilt function is spelled
differently (this is from memory, so you'll need to check it:-

strSQL = "SELECT * FROM Table1 WHERE Start_Date <= @@SYSTEMDATE"


Hope that helps


Tim F
 
Back
Top