how to only show the records that entered today???

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mostafa moniem
    New Member
    • Apr 2016
    • 18

    how to only show the records that entered today???

    i want to show all record saved today (the date field = Date())
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Mostafa,
    in the simplest situation, in Query editor you only need to set the criteria equal to Now()

    However, you will find that because of the way access stores dates there's a hidden time included with the date (00h00)

    So often one may have to use something like:
    >= [Now()] < [Now()] + 1

    And there's a twist on the date is stored so that if the date is stored: mm/dd/yyyy hh:mm:ss and you only enter m/d/yy then search may fail.

    Please refer to:
    Dealing with international dates: http://allenbrowne.com/ser-36.html

    Please check you PM in a little bit, I'll forward you my boilerplate of general links and tutorials that should help you get things going.
    Last edited by zmbd; Apr 27 '16, 08:16 PM.

    Comment

    • mostafa moniem
      New Member
      • Apr 2016
      • 18

      #3
      no all i need to get all the records entered in the whole day ,, not in the time .. did u understand ?

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Hi Z.
        Actually, it's really not necessary to complicate matters when dealing with the current date. Date() returns exactly that - with no time element included.

        When dealing with dates, as opposed to times or timestamps (A set date and time.), it's never a good idea to use Now(). I've seen it recommended many times, but that doesn't make it right.

        BTW. There are functions (DateValue() & TimeValue()) which will separate out the date and time elements from any timestamp value.

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #5
          NewPa: learn something new and you are all too right in that what is often suggested isn't always the best, nor correct, way to do things.

          TBH - I've typically used the NOW() as most of my work in the lab requires the time component for auditing reasons; thus, this function tends to be my default for dates. :)

          Comment

          Working...