week number SOS

  • Thread starter Thread starter Art Vandaley
  • Start date Start date
A

Art Vandaley

Hi,

In access 2007 Beta I have following problem:

text1.value = calendar1.value (text1's format is "ww")

text1 returns 53 for the date of 29.12.2006. Normally it must be 52

How can I fix this problem?

How can I use "firstweekof year" ?

PS: "Format(expression[, format[, firstdayofweek[, firstweekofyear]]])"
means nothing to me. I need more explanation. Where should I put the format
VB or properties?

Thanks a lot for your help in advance..
 
However... Art's got a real problem. 2006 started on a Sunday, with a
full week. Access2003 returns:

?datepart("ww",#12/29/2006#)
52

Seems that there is indeed a discrepancy between A2003 and A2007!
Nope, it is the 53rd week if the week starts on Monday.
Week 1 was a fragment.

Art Vandaley said:
Hi,

In access 2007 Beta I have following problem:

text1.value = calendar1.value (text1's format is "ww")

text1 returns 53 for the date of 29.12.2006. Normally it must be 52

How can I fix this problem?

How can I use "firstweekof year" ?

PS: "Format(expression[, format[, firstdayofweek[, firstweekofyear]]])"
means nothing to me. I need more explanation. Where should I put the
format
VB or properties?

Thanks a lot for your help in advance..

John W. Vinson[MVP]
 
It sounds like its defaulting to the vbUseSystemDate constant for the first
day of the week, which has a value of 0, and your system follows the ISO
standard of Monday being the first day of the week (which as you've used a
European date format is likely to be the case). Normally Access has
defaulted to the vbSunday constant which has a value of 1. The ISO standard
specifies Monday as the start of the week and the first week of the year as
that containing the first Thursday. Days in the year prior to that week are
considered part of the previous year. Access defaults to the first week
containing Jan 1 as the first week of the year, however, so when using the
system date setting for the first day of the week, for 2006 Sunday 01/01/2006
would be the only day of week 1.

If Access 2007 has changed the default behaviour, then it serves to
emphasise the advice often given that the first day of the week and first
week of the year arguments should always be specified, so in your case change
your code to the following to recreate the previous default behaviour:

text1.value = DatePart("ww", calendar1.value, vbSunday, vbFirstJan1)

and remove the format property setting for the text box.

Ken Sheridan
Stafford, England
 
Back
Top