Solved

How to create a query based on people who have a certain date in the next week

Posted on 2014-02-14
4
305 Views
Last Modified: 2014-02-14
I would like to create a list of people who have an expiration date in the next week.  I know that seems easy.  But if someone can help me with this one I can probably do the rest.
0
Comment
Question by:lehi52
  • 3
4 Comments
 
LVL 22

Expert Comment

by:Flyster
Comment Utility
You can use this in the Criteria section of your query:

=DatePart("ww",Date())+1

This will show every date that is one week more than the day the query is run.

Flyster
0
 

Author Comment

by:lehi52
Comment Utility
I must be doing something wrong,  Its not returning any names.  I have one person that meets that criteria and they are not showing up.  Here is what I did:

The three fields it is supposed to return are policy name,   WCF POL#, and Exp Date.  I put this =DatePart("ww",Date())+1  into the criteria under exp. date.
0
 
LVL 22

Accepted Solution

by:
Flyster earned 500 total points
Comment Utility
Sorry, my error. That's what happens when you rush. It should be:

=DatePart("ww",[YourDateField]) = DatePart("ww",Date())+1

Just change [YourDateField] to the name of your date field in the query.
0
 
LVL 22

Expert Comment

by:Flyster
Comment Utility
Thanks for the points, but I just thought of one slight problem with the submitted solution. It will work for the first 51 weeks of the year, but not the last. Here's a better one that will work no matter what time of the year it is:

DateDiff("ww",Now(),[Day])=1

So when it gets to the end of December, it will still know that January is just 1 week away!
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 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

7 Experts available now in Live!

Get 1:1 Help Now