Results 1 to 5 of 5

Thread: Help with Date

  1. #1
    Join Date
    Nov 2005
    Posts
    26

    Unanswered: Help with Date

    I need to create simple code for filling textbox ("newdate") with date. That date should be current year, november 1st or next year march 1st depending on the time when some button was pressed.

    E.g. if the month (current), when i press button is after march then Newdate = 2006.11.01 , but if after november then Newdate = 2007.03.01.

    2006 - current year
    2007 - next year


    E.g. If button is pressed on 2008.12.10 then Newdate = 2009.03.01 and so on.

    I can get current month value with function: month(date). If it is between 3 and 11 then newdate = xxxx.11.01 , if it is 12,1,2 then new date = xxxx.03.01

    But how do i make xxxx = currentyear and add it to final newdate result?

    year(date)+11+01 ? that is wrong syntax i guess...




    Thanks

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    "+" adds numbers together. You want to create a date string:

    year(date) & ".11.01"
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Teddy
    "+" adds numbers together.
    It is also a concatenation operator - it behaves like the T-SQL "+" concatenation operator
    i.e.
    "Teddy" & NULL = "Teddy"
    "Teddy" + NULL = NULL
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    In this case though you are right - like you I would expect Access to try to come up with a total for the values
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Nov 2005
    Posts
    26
    Thanks,it works!

Posting Permissions

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