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. #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.

  3. #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
  •