By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,030 Members | 2,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,030 IT Pros & Developers. It's quick & easy.

Is there an easier way to do week range?

P: 20
Hi, I was wondering if there's an easier way to get a week range than what I'm currently using. Right now I use something along these lines, where drequest is the date

Format([drequest],"yyyy") & IIf(Format([drequest],"ww")<10,"0" & Format([drequest],"ww"),Format([drequest],"ww"))

this would be an example criteria for it to find out all dates between weeks 7 and 35

between 200607 and 200635

The biggest problem I have with this is if I just do
Format([drequest],"yyyyww")
any week before the 10th week wont put a 0 in front of it and then you end up with numbers like 20067.

Anyway, just wondering if there's an easier way.
Aug 6 '07 #1
Share this Question
Share on Google+
5 Replies


Rabbit
Expert Mod 10K+
P: 12,366
Seeing as how you already have the date, why do you need to format it into a string?
Aug 6 '07 #2

P: 20
Seeing as how you already have the date, why do you need to format it into a string?
Because we go by ship weeks here and weeks vary depending on the year, I've created a report that goes off of week instead of date to help the users enter data in a format they understand instead of having to look up what the beginning and end of each week is every time.

An example is august 6th this year falls on the week from august 5th to the 11th, next year it will fall on the week of august 3rd to the 9th, the year after that will be the 2nd to the 8th, and so on.
Aug 6 '07 #3

Rabbit
Expert Mod 10K+
P: 12,366
drequest is a date though right? Where does that come from if they enter date in a text format?

This will give you the same results.
Expand|Select|Wrap|Line Numbers
  1. Year(drequest) & Right("0" & Month(drequest), 2)
  2.  
Aug 6 '07 #4

P: 20
drequest is a date though right? Where does that come from if they enter date in a text format?

This will give you the same results.
Expand|Select|Wrap|Line Numbers
  1. Year(drequest) & Right("0" & Month(drequest), 2)
  2.  
that wont give the same thing, I'm using "ww" for weeks, not "mm" for months, however, I can substitute the week in there and that should work, thanks ;)
Aug 6 '07 #5

Rabbit
Expert Mod 10K+
P: 12,366
Yeah, week().. that's what I meant.

Good luck.
Aug 6 '07 #6

Post your reply

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