• Creator
  • #2148333

    Access Date Question


    by shurt ·

    I have a query in Access that I want to show me the past 24 hours, starting with the last hour and going back 24. I’ve tried =Date()-1 and that shows me yesterday, but not what I need. If anyone could help I’d greatly appreciate it. Thanks.

All Answers

  • Author
    • #2565830


      by shurt ·

      In reply to Access Date Question


    • #2565828

      This might help you…

      by Anonymous ·

      In reply to Access Date Question

      Access Date Functions

      This list gives a brief description of the most useful date functions in Access. Access Help gives more details and will describe exactly how these functions operate in your version of Access.
      Note that functions are always followed by a pair of brackets even if – like Date() – there’s nothing in them. The Access editor will sometimes remove these brackets but by entering them you are telling Access that you are attempting to use a function.

      Gives today’s date. Date$() gives it as a string. There is also a Date command which sets the system date.
      Gives the day of the month (1 .. 31) of
      Adds an interval to
      . The intervals can be anything from seconds to years.
      DateDiff(, , )
      from and gives the result in the unit specified as .
      , )
      Extracts part of
      , for example the minute, week or quarter.
      , )
      Returns as a text string in the format specified.

      Please post back if you have any more problems or questions.

    • #2565711

      Depends on what you mean by last hour, …

      by tony hopkinson ·

      In reply to Access Date Question

      Select * from MyTable
      DateDiff(hour,Date(),MyDateField) < 24 should give you a start. It's the number of whole hours though, so DateDiff(minute,Date(),MyDateField) < (24 * 60), might do you better.

Viewing 2 reply threads