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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Expression to get last day of month… (97 SR-2)

    Author
    Topic
    #391696

    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??… laugh

    Viewing 1 reply thread
    Author
    Replies
    • #700556

      (Edited by D Willett on 07-Aug-03 17:48. )

      You can set this as the control source of a text box, if this what you were after.

      =DateSerial(DatePart(“yyyy”,Date()),DatePart(“m”,Date())+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.

      • #700563

        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… laugh)

        Anyway… As always, I appreciate the help!… thankyou

    • #700559

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

      • #700567

        Thanks Peter! I think that’s the one that Hans posted… A short expression… cheers

    Viewing 1 reply thread
    Reply To: Expression to get last day of month… (97 SR-2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: