473,385 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Query criteria - Looking for 5 weeks from this week

17
I need the criteria to pull all dates for five weeks from this week.

I am using the following for query criteria and it works, but now that the year is ending, it does not work.

Expand|Select|Wrap|Line Numbers
  1. Year([Activity Date])*53+DatePart("ww",[Activity Date])= Year(Date())*53+DatePart("ww",Date())+5
Nov 21 '14 #1
5 1199
MikeTheBike
639 Expert 512MB
Hi

I do not understand why you are multiplying by 53, but I suspect the criteria fails when the [Activity Date] changes to January next year because the Date part changes from 52/53 in the previous week to 1 and is therefore less than DatePart (week) of to-day.

Without knowing what you are trying to do or anything about your data, would this criteria be of any use

Expand|Select|Wrap|Line Numbers
  1. [Activity Date] = DateAdd("ww", 5, Date())
??


MTD
Nov 21 '14 #2
GDC1970
17
Thank you for your assistance.
That works but it only gives me all my activity dates on Friday 5 weeks out. I need it to show me all dates Monday through Friday 5 weeks out.
Nov 21 '14 #3
Rabbit
12,516 Expert Mod 8TB
Use less than or equal to instead of equal to.
Nov 21 '14 #4
GDC1970
17
It does not go into next year since the weeks start over. 1-52
Nov 21 '14 #5
Rabbit
12,516 Expert Mod 8TB
I know, that's why Mike suggested using DateAdd. And if you wanted stuff in between, that's why I suggested using less than or equal to in addition to his DateAdd.
Nov 21 '14 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: keliie | last post by:
Hello Just a quick question that I've spent a few hours trying to solve with no luck (although one would think this should be fairly easy). I have a form with a subform. The subform is based...
14
by: Tina | last post by:
My employer tracks productivity/performance of clinicians (how much they bill) each week, its averages for the month, and the 6 months. These averages are compared to their expected productivity....
3
by: stevecat | last post by:
Hi there, I have created a form, "search" and a query "search_product". The query returns the product information based upon the criteria for three of the fields, author, title or isbn. The field...
1
by: DavidB | last post by:
I am working with a database and I would like to be able to populate an array at run time and then use the values that were pushed into the array as criteria for a select query. It seems that this...
4
waynetheengineer
by: waynetheengineer | last post by:
Hi, I was wondering if anyone had any suggestions on my database: I have a form that accepts user input into a single text box. When the OK button is hit, a query should search for all records...
3
by: ericargent | last post by:
Hi I'm using Acces 2003 I have Query where the several parameters for the criteria are supplied from a form. One parameter source is a combo box. What I am trying to do is if: An item is...
2
by: cmartin1986 | last post by:
First of all I want to thank all of you that have helped me in the past this is an awesome fourm. My problem today is I have a database that builds charts that are viewed by a large group every...
4
by: tbeers | last post by:
Is there a method to pass along a criteria argument directly to the query criteria rather than through filtering a form or report? In other words, I would like to click a "print" button and in the...
8
by: limperger | last post by:
Hello everyone! First and foremost, my apologies for the title of the post. It is not very clarifying of what the problem is about, but I didn't know how to put it... My problem is as follows: I...
7
by: erichusa86 | last post by:
Hi Basicaly i have a combo box with two options "ug" and "dh". this is the VBA code i have so far: Private Sub cbosample_AfterUpdate() Dim SampleType As String If Me.cbosample = "dh" Then...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.