Solved

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

Posted on 2014-02-14
4
308 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
ID: 39859961
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
ID: 39859985
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
ID: 39860118
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
ID: 39860945
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
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…
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…

895 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

13 Experts available now in Live!

Get 1:1 Help Now