Solved

Access Query - Select two separate dates

Posted on 2009-07-07
5
190 Views
Last Modified: 2012-05-07
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?
0
Comment
Question by:Pdeters
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:shoppedude
ID: 24796933
It is very possible - could you please attach the code that you are presently using?

Thanks!
0
 
LVL 2

Expert Comment

by:Netwoobie
ID: 24797218
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
 

Author Comment

by:Pdeters
ID: 24797268
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
 
LVL 2

Accepted Solution

by:
shoppedude earned 500 total points
ID: 24797433
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
 

Author Closing Comment

by:Pdeters
ID: 31600734
Thank you
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now