Week Numbers Error (DatePart)

thescottsman92

Registered User.
Local time
Today, 16:09
Joined
Sep 2, 2013
Messages
24
Hi all

I need to get the week number. I am using datepart in the correct way of =datepart("ww",me.txt).

However for some reason it is adding an extra week. For example at the moment it is meant to be week 2, but the textbox is showing week 3.

I have looked at this in mor detail and it doesn't occur next year. I am assuming that this is an error with microssoft.

Does anyone know of the fix for it?

Thanks
 
Hi

It finds the same result
 
It's not error really, it's because of using default values for parameters you omitted.
DatePart function looks like that:
DatePart ( interval, date, [firstdayofweek], [firstweekofyear])
If you don't input [firstdayofweek] and [firstweekofyear] parameters then Access uses default ones for it meaning Sunday as first day of week and week including 1st of January. And that's why it's showing current week number as 3 instead of 2.
More here: http://www.techonthenet.com/access/functions/date/datepart.php
 
going on from what cyanidem says, if you don't want the defaults then everywhere you evaluate a weekno within your system, you need to ensure that you are using consistent settings for the [firstdayofweek] and [firstweekofyear] parameters.
 

Users who are viewing this thread

Back
Top Bottom