Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2009
    Posts
    28

    Question Unanswered: help with date handling in FORMS

    My table has a {start of year} date in the format “dd/mm/yyyy”.
    I need to pick this up as ‘week1', and then add 7 days, for a whole year,
    so that I can display :-
    ‘week2’, ({start of year} + 7 days)
    ‘week3’, ({start of year} + 14 days)
    etc, etc, right up to ‘week52’.
    Is there an easy way do this in FORMS, presumably with a date function ?
    I haven't had any VB or ACCESS training.
    Many thanks in anticipation…..

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Out of time...

    Hint:
    WeekNumber : DateAdd("d", WeekNumber*7, StartOfYear)

    Might be a better way too, I'll think about it while driving
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    You'll need a loop structure.

    I have something similar that populates a table for a report whenever the report is opened - it prompts for a year, calculates the start date of the financial year from that, and then calculates other dependant values (week number and period number. Then it adds a week to the start and starts a loop until it reaches week one of period one again. It finishes here, and opens the report.
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  4. #4
    Join Date
    Jul 2009
    Posts
    28
    Thanks StarTrekker : I used your suggestion and it works beautifully.
    Weejas : I am going on some Access Training later this month, and will specifically ask about loops. I tried it for this example, but couldn't get the syntax right, so ended up manually inputting 52 weeks.

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're welcome.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •