Solved

Access Query - Select two separate dates

Posted on 2009-07-07
5
215 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 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