Date on a report or form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmar93
    New Member
    • Mar 2008
    • 46

    Date on a report or form

    I am new to Access and was hoping someone could help me with a question. On a report or form you can place "=Date()" in a text box to display the current date, is there a way to have it display the dates of the current week, Sunday - Saturday?

    thanks,
    Jeff
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Hi Jeff

    Welcome to TheScripts family.

    Feel free to post questions in the related forum only by choosing from under the blue bar on the top of your page.

    Please follow the posting guidelines in every new post/reply.

    Please specify your post/question clearly.Please use proper code tags in all your codes.

    Regards
    Debasis

    Comment

    • grays
      New Member
      • Mar 2008
      • 1

      #3
      Originally posted by jmar93
      I am new to Access and was hoping someone could help me with a question. On a report or form you can place "=Date()" in a text box to display the current date, is there a way to have it display the dates of the current week, Sunday - Saturday?

      thanks,
      Jeff
      try this...

      =Date()-Weekday(Date()) +3

      this will give you tuesday of the current week
      Wed +4
      Thur +5
      Fri +6
      Next Mon +9

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        For the start and ending dates of the week:

        Code:
        Date() - (Weekday(Date()) - 1) & " - " & Date() - Weekday(Date()) + 7
        Welcome to TheScripts!

        Linq ;0)>

        Comment

        • jmar93
          New Member
          • Mar 2008
          • 46

          #5
          Thanks for the replies, works great. Just the help I needed.

          thanks again,

          Jeff

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            Glad we could help!

            Linq ;0)>

            Comment

            • jmar93
              New Member
              • Mar 2008
              • 46

              #7
              Originally posted by missinglinq
              For the start and ending dates of the week:

              Code:
              Date() - (Weekday(Date()) - 1) & " - " & Date() - Weekday(Date()) + 7
              Welcome to TheScripts!

              Linq ;0)>
              How would I write this to display the dates of the current month or the previous month?

              thanks,
              Jeff

              Comment

              • missinglinq
                Recognized Expert Specialist
                • Nov 2006
                • 3533

                #8
                If you mean the first and last of the current month and first and last of the previous month:

                'First of the current month
                DateSerial(Year (Date), Month(Date), 1)

                'Last of the current month
                DateSerial(Year (Date), Month(Date) + 1, 0)

                'First of the previous month
                DateSerial(Year (Date), Month(Date) - 1, 1)

                'Last of the previous month
                DateSerial(Year (Date), Month(Date), 0)

                Linq ;0)>

                Comment

                • jmar93
                  New Member
                  • Mar 2008
                  • 46

                  #9
                  Originally posted by missinglinq
                  If you mean the first and last of the current month and first and last of the previous month:

                  'First of the current month
                  DateSerial(Year (Date), Month(Date), 1)

                  'Last of the current month
                  DateSerial(Year (Date), Month(Date) + 1, 0)

                  'First of the previous month
                  DateSerial(Year (Date), Month(Date) - 1, 1)

                  'Last of the previous month
                  DateSerial(Year (Date), Month(Date), 0)

                  Linq ;0)>
                  Works perfectly.

                  Thank you,

                  Jeff

                  Comment

                  • missinglinq
                    Recognized Expert Specialist
                    • Nov 2006
                    • 3533

                    #10
                    Glad we coul help again!

                    Linq ;0)>

                    Comment

                    Working...