Solved

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

Posted on 2014-02-14
4
313 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

733 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