Results 1 to 2 of 2

Thread: Date function

  1. #1
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Using Access 2000

    A table has a Date field called CurDate, set to the default date of new record entered.

    On a form, I would like shown:
    If CurDate is between January 1 and June 30 of a given year, I would like that year shown...otherwise that year + 1.

    In other words...
    If the date of the new record is between January 1 and June 30 of 2010, the year 2010 would show on the form.
    If the date of the new record is between July 1 and December 31 of 2010, the year 2011 would show on the form.

    Thanks.

    Tom

  2. #2
    Star Lounger
    Join Date
    Sep 2002
    Location
    Hastings, Sussex, England
    Posts
    67
    Thanks
    0
    Thanked 1 Time in 1 Post
    Tom,

    you want a simple function along the lines of

    if curdate =>cdate("01/07/" & year(curdate)) then

    Return year(curdate)+1

    else

    return year(curdate)

    end if

    I am sure you can tidy this up and get the syntax right! Could even be done with an IIF().

    Hope this helps,

    Jules

Posting Permissions

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