Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Expression to get last day of month... (97 SR-2)

    I believe I remember Hans posting a really short expression to get the last day of the month... Something about a rule that Access defaults to the first day of the month in some situation where it didn't know the day... I think...

    Uggg!... I can't remember anything lately... Stress!!! ... What is happening to my brain??... <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression to get last day of month... (97 SR-2)

    <P ID="edit" class=small>(Edited by D Willett on 07-Aug-03 17:48. )</P>You can set this as the control source of a text box, if this what you were after.

    =DateSerial(DatePart("yyyy",Date()),DatePart("m",D ate())+1,1)-1

    or if you want it from a button, you can use

    Me.Text0 = DateSerial(DatePart("yyyy", Date), DatePart("m", Date) + 1, 1) - 1

    Text0 should be changed to your text control name and put in the on click event of the button.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wetherby, Yorkshire, England
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression to get last day of month... (97 SR-2)

    Or if you want it even shorter:
    DateSerial(Year(Now),Month(Now)+1,0)
    Peter

  4. #4
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression to get last day of month... (97 SR-2)

    Thanks Dave...

    I'm adding it to a procedure that sets a Swap reset date depending on the interval chosen... It used to be that the traders picked a particular day of the month that would apply to all float, fixed or compound payment/reset dates... Now they've decided they want the last day of the month option, so I'm doing some upgrading to the application I designed for them a couple of years ago... (I know, I know... TMI... <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>)

    Anyway... As always, I appreciate the help!... <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

  5. #5
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression to get last day of month... (97 SR-2)

    Thanks Peter! I think that's the one that Hans posted... A short expression... <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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