PDA

Click to See Complete Forum and Search --> : DATE PROBLEM! URGENT!!


vbdeveloper
Nov 26th, 2000, 03:18 AM
Dear Reader,
I have a access database table named 'sales'.
'sales' table contains a field named 'solddate'.


(1). I am dynamically generating a ASP pages which gets data from this table. The condition i want to set for retreiving the records from the table is that the records retreived should not contain the records that have been added today, i.e. i want to retreive the records not having the value in 'solddate' field as todays date. How do I go about this?

(2). I want to dynamically delete the records from the 'sales' table such that the table contains records of the last seven days i.e. Any records that have the 'solddate' field value less than seven days less than today should be automatically deleted. How do i do that?

Any Code would be of great help.
Thanks in advance.

Mark Sreeves
Nov 27th, 2000, 06:05 AM
assuming that youor solldate field is of type date these should work


strSQL = "SELECT * FROM sales where solddate < " & now() & ";"






strSQL = "DELETE * FROM sales where solddate < " & now() -7 & ";"
conn.execute(strsql)

vbdeveloper
Nov 27th, 2000, 08:42 AM
Thank you very much.

That worked and it helped.

Bye for now!