Subtracting date from system date MS Access

  • Thread starter Thread starter Rooh
  • Start date Start date
R

Rooh

Hello everyone;
I hope some will have a hint or a full solution to my this problem;
I want to retrieve data from MS Access table based on date.
What format should I use with the Access Date() or Now() function to
give me yesterday date.

For example i have a column with date and time. let say i want today to
retrive all data which was inserted since yesterday. i want to use
Now() or Date() function in my query.
thank you and looking forward for your responses.
 
Rooh said:
Hello everyone;
I hope some will have a hint or a full solution to my this problem;
I want to retrieve data from MS Access table based on date.
What format should I use with the Access Date() or Now() function to
give me yesterday date.

For example i have a column with date and time. let say i want today
to retrive all data which was inserted since yesterday. i want to use
Now() or Date() function in my query.
thank you and looking forward for your responses.

The use of Date() versus Now() depends on what you mean by "since
yesterday". If you mean since midnight at the start of yesterday then use
Date(). If you mean exactly 24 hours from the current time then use Now().
Either of the queries below will give you those results.

SELECT *
FROM TableName
WHERE DateField >= Date()-1

or

SELECT *
FROM TableName
WHERE DateField >= DateAdd("d", -1, Date())
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top