473,387 Members | 1,516 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,387 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 1200
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.