Dates in query criteria

  • Thread starter Thread starter Louise
  • Start date Start date
L

Louise

Dear Experts,

I want to create a delete query where records should be
deleted if the check-out date has been passed. I am
organising temporary accomodation for students in a
residence. I want to say... If the check-out date is
earlier than now() (ie passed) then delete the record.

regards

Louise
 
Dear Experts,

I want to create a delete query where records should be
deleted if the check-out date has been passed. I am
organising temporary accomodation for students in a
residence. I want to say... If the check-out date is
earlier than now() (ie passed) then delete the record.

regards

Louise

Ok... you've answered your own question, pretty much!

Create a Delete query based on the table. On the Criteria line under
Checkout Date put

< Date()

Run the query.

Now() returns the current date and time to microsecond accuracy; you
may delete some or all of today's records if you use Now() - Date()
returns only the date portion of the date/time value.
 
John said:
Ok... you've answered your own question, pretty much!

I'd say that is a virtue. Louise clearly knows what she wants, is able
to formulate this, and just needs clarification how to do it.

That is a fertile attitude to become a sound developer.
 
On the same subject, what would the criteria be to delete records with
a date field, (ie. Ship_Date) where the shipping date is at least 7
days past.
Something like <=Date()-7days, but I cant figure out how to specify
the 7 day interval.

Many Thanks
Dudley
 
Dudley said:
On the same subject, what would the criteria be to delete records with
a date field, (ie. Ship_Date) where the shipping date is at least 7
days past.
Something like <=Date()-7days, but I cant figure out how to specify
the 7 day interval.

<= Date() -7

Tell me you haven't tried!
 
Back
Top