Results 1 to 7 of 7
  1. #1
    Nikki17 Guest

    Week number wrong

    I am extracting some information from my database in week format.
    I have done this in the normal way of using the Format function and W.
    The week number it gives me is one ahead of actual week number in my diary.
    Has anyone else come across this, or know how to fix it??

  2. #2
    John Spencer Guest

    Re: Week number wrong

    The week number is dependent on two factors - what is the first day of the
    week and how is the first week defined. Take a look at the help on the
    format function. You may need to use

    Format("ww",SomeDate,2,3)

    That says return the week number for some date where the week starts on
    Monday and week number 1 of the year is the first week with seven days. If
    you didn't set those arguments, then your week number is based on Sunday
    and week number 1 is the week that contains January 1.

  3. #3
    Jeff Boyce Guest

    Re: Week number wrong

    Perhaps your Windows settings specify a different start day for the year
    than you are using?

    --
    Regards

    Jeff Boyce
    <Office/Access MVP>

  4. #4
    Emma Hope Guest

    RE: Week number wrong

    Simply speaking you could write your formulae and put -1 at the end, i.e.
    minus 1 from each week number to give the correct value.

  5. #5
    Nikki17 Guest

    Re: Week number wrong

    Thanks John that works. I don't understand what the 3 does though. I am
    assuming the 2 is to start the day on Monday? Could you confirm what the 2,
    and 3 relate to?

    "John Spencer" wrote:
    The week number is dependent on two factors - what is the first day of the
    week and how is the first week defined. Take a look at the help on the
    format function. You may need to use

    Format("ww",SomeDate,2,3)

    That says return the week number for some date where the week starts on
    Monday and week number 1 of the year is the first week with seven days. If
    you didn't set those arguments, then your week number is based on Sunday
    and week number 1 is the week that contains January 1.

  6. #6
    John Spencer Guest

    Re: Week number wrong

    The 2 argument is Monday
    The 3 argument is Week 1 of the year has seven days in the year.

    For an explanation, look them up in VBA help.
    -- Open up your application
    -- Type Control G
    -- Press the F1 key
    --Click the Index tab
    --Type Format Function in the Keywords entry
    --Click on Search
    --Click on Format Function in the Choose a Topic list

    OR
    -- Open up your application
    -- Type Control G
    -- Press the F1 key
    -- Click on the Contents tab
    -- Select Visual Basic Language Reference: Functions:D-G: Format Function

  7. #7
    Join Date
    Mar 2006
    Posts
    17
    Thanks John & Nikki; adding the '3' argument was all I needed to solve my problem with weeks 53 ('05) and 1 ('06) overlapping which I posted this morning!

    Schwagr

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-12-2009, 09:55 AM
  2. Sum Of Positive Number and Negative Number
    By maysamab in forum Reports
    Replies: 1
    Last Post: 10-20-2008, 04:06 PM
  3. What am I doing wrong?
    By brandon in forum Access
    Replies: 2
    Last Post: 08-03-2008, 10:26 AM
  4. DMax returning wrong value
    By nedbenj in forum Access
    Replies: 7
    Last Post: 10-24-2007, 10:30 AM
  5. Day of Week Totals
    By ddog171 in forum Queries
    Replies: 1
    Last Post: 03-18-2006, 07:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums