Solved

MS Access 2010 Date help

Posted on 2014-12-08
2
206 Views
Last Modified: 2014-12-08
Hi
Need help with the following please.
We have a query that contains a date field. What we cant to do is add 7 days to this date and then show the last 30 days from today.
So for example I have the following

Date in Table           Add 7 Days      
01/09/2014              08/09/2014
01/12/2014              08/12/2014
02/12/2014             09/12/2014

I can get the query to add 7 days and show the correct date, but I also then want the query to only show me records that have a date from today 30 days back based on the new date I have created, so from the example above the would only return 2 records that have a date in December.  I cant seem to do that as I can seem to add a query to the field that creates the new date, If I try and then run the query I get the "enter parameter value"

Thanks
0
Comment
Question by:George_Milton
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 40486494
It would help if you'd show the SQL of your query.

Adding 7 days is straight forward:

SELECT Field1, DateAdd("d", 7, YourDateField) AS NewDate FROM SomeTable

This would create a column named NewDate in the query, and would add 7 days to a field named YourDateField.

If you then want to query and filter on YourDateField for values starting at 30 days in the past:

SELECT YourDateField, DateAdd("d", 7, YourDateField) AS NewDate FROM SomeTable WHERE YourDateField >= DateAdd("d" , -30, Now)
0
 

Author Closing Comment

by:George_Milton
ID: 40486502
Thank you that worked exactly as I expected
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

820 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