Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access Query - Select two separate dates

Posted on 2009-07-07
5
Medium Priority
?
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

719 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