Full Version: Current Week
UtterAccess Discussion Forums > Microsoft® Access > Access Date + Time
StephenJagger
Afternoon All,
I'm having a bit of a thick day today, can't seem to work this out.

I've got these two fields on a form which works out the current week for this year.
[StartCurrentWeekTy]
=Date()-Weekday(Date(),0)+1
[EndCurrentWeekTy]
=Date()-Weekday(Date(),0)+7

I need to be able to also add the fields for the current week for last year??
[StartCurrentWeekPy]
???????? (result should be 13/10/2003)
[EndCurrentWeekPy]
???????? (result should be 19/10/2003)

I've tried using dateadd to remove the year but the days are wrong,
Any help will be greatly appreciated
khaos
Try this

=dateadd( "yyyy",-1,Date())-Weekday(dateadd( "yyyy",-1,Date()),0)+1

Don't know if this is what you want but hopefully it helps,
Ken
StephenJagger
Thanks Ken
That works a treat.
khaos
You're welcome, glad to help.
StephenJagger
What would be the best way to calculate the equivelant day last year to today.

ie today is friday 15th
last years equivelant friday would be the 17th
khaos
What makes that last years equivelant to you? They don't have the same day number in the year

today is day 289
10/17/2003 is day 290

I can use vb to get those. Do you just want the friday of the week that has Oct. 15th in it? I'm sure I could modify or write something for that.

Ken
StephenJagger
Hi ken,

In our company we compare sales against last years sales on a day vs day basis, not date vs date.
It's so that our sales for our busiest day saturday would never be compared to a sunday, which would
happen if we were comparing dates.

hope this makes sense
khaos
This statement will return the same day of the week for a day supplied.

dateadd( "d",weekday(#10/14/2004# ,vbSunday)-weekday(Dateadd("yyyy",-1,#10/14/2004#),vbSunday),Dateadd("yyyy",-1,#10/14/2004#))

I think thats what you want.

Tell me if you have any problems, working out these types of issues is a lot of fun and a good learning experience for me.

Ken
StephenJagger
thanks ken
khaos
You're welcome
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.