Results 1 to 3 of 3

Thread: DATE PROBLEM! URGENT!!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    20

    Lightbulb

    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.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    assuming that youor solldate field is of type date these should work

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

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    20

    Thanks

    Thank you very much.

    That worked and it helped.

    Bye for now!



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width