Solved

MS Access 2010 Date help

Posted on 2014-12-08
2
212 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
[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 Comments
 
LVL 85

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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