PDA

View Full Version : Display records based on date comparison



NGJ
06-28-2006, 12:11 AM
I've created a form - the contents of which are written to my Access database table. Fine.

However, I want to display only those records where the submission date was within, say, the last 10 days. The date of submission (sub_date) is captured within the table - so this value is available to be compared against for each record.

Can someone please show me how I can compare this value against the current date - checking if it falls within the '10 day' window and then displaying only those records..?

I think I can somehow achieve this with the 'DateDiff' function...but I haven't found an example to explain how?

Thanks in advance,

N.

NGJ
06-28-2006, 04:16 PM
Thinking on.... I've got this far.... It's just not quite right...

Can anyone help please?


recent = DateAdd("d",-10,date())

MySQL="Select * FROM " & strTable & " where Sub_Date >= " & recent & ""

Set MyRs=MyConn.Execute(MySQL)

Twey
06-28-2006, 04:30 PM
Don't think anyone speaks ASP here :)
Maybe the well-named Otaku... but he's hardly ever here.