Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete Query (2000)

    I am trying to delete records from a table that are older than one year from the current date. Here is my query:
    DELETE tblDataLogger.ID, tblDataLogger.Unit1, tblDataLogger.Unit2, tblDataLogger.Month, tblDataLogger.Day, tblDataLogger.Year, tblDataLogger.Hour, tblDataLogger.Minute, [month] & "/" & [day] & "/" & [year] AS Datestamp
    FROM tblDataLogger
    WHERE ((([month] & "/" & [day] & "/" & [year])<=Date()-365));

    However this does not find the records older than one year. Can someone please help.
    Thanks,

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Delete Query (2000)

    Instead of

    DateStamp: [month] & "/" & [day] & "/" & [year]

    which results in a text value, try

    DateStamp: DateSerial([year], [month], [day])

    which results in a real date/time value.

  4. #3
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete Query (2000)

    Thanks, that works.

Posting Permissions

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