Access Query - Select two separate dates

I have an Access query that I am using to append to another table.

I want to pull from a date field that would be the last date besides today ie. if there were 10 records accessed yesterday I want those to append to the new table not anything accessed today.

If the last time some recrods were accessed was 2 days ago i want those to append to the new table but not anythign from today.

Is this possible without typing in the date?
PdetersAsked:
Who is Participating?
 
shoppedudeConnect With a Mentor Commented:
This code should work, returning the maximum date from the table where the date is less than the current date.

-Lee
SELECT DISTINCT Table1.Date_Change
FROM Table1
WHERE Table1.Date_Change = (SELECT MAX(A.Date_Change) from Table1 A WHERE A.Date_Change < Date())

Open in new window

0
 
shoppedudeCommented:
It is very possible - could you please attach the code that you are presently using?

Thanks!
0
 
NetwoobieCommented:
You should look into the datediff function. Your query could check if your number of days between your field date and the current date is 1 or 2 and select those into another table.

http://www.techonthenet.com/access/functions/date/datediff.php

0
 
PdetersAuthor Commented:
This is what I am currently using

SELECT Table1.Date_change
FROM Table1
WHERE (((Table1.Date_Change)=[Select Date]));

I am actually selecting the date
0
 
PdetersAuthor Commented:
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.