Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Posts
    15

    Unanswered: Delete Query - Please Help

    I have built a delete Query that i want to delete all records in a table that are less 30 days from the date of executing the query.

    Here is the criteria i have written, but it only deletes records less than todays date, i alwyas want at least the past 30 days of records in the system.

    <Date()-(30)

    Please help in telling me what i am doing wrong - Thanks

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    try criteria along the lines of:
    between dateadd("d", -30, date()) and date()

    izy

  3. #3
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447
    Originally posted by izyrider
    try criteria along the lines of:
    between dateadd("d", -30, date()) and date()

    izy

    .... or easier
    WHERE DateDiff("y", [Your Record Date], Date()) >= 30


    ... or te get rid of everything except the current and previous month
    WHERE DateDiff("m", [Your Record Date], Date()) > 1
    Make everything as simple as possible, but not simpler! - A. Einstein
    DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool

  4. #4
    Join Date
    Aug 2003
    Posts
    15
    Thanks that really seem to do the job - One last question I can not seem to figure out how to execute a Delete QUery from a Data Access Page?

    Any ideas?

Posting Permissions

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