Select last hour of data in Access query

John Ross 1 Reputation point
2022-02-18T02:54:54.663+00:00

I want to pull data for the last hour or two from a table but the data field and time field are separate fields.

The field "date_stamp" is a Date/Time field but the "time_stamp" field is short text. I cannot find a way to combine these to grab my data for the last hour.

Thank you!

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
870 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Karl Donaubauer 1,726 Reputation points MVP
    2022-02-18T12:37:07.137+00:00

    Hi,

    If you have valid formatted time data in your text field then you should be able to use this in a query:

    date_stamp+CDate(time_stamp)

    and as criteria for the last 1 hour: >=DateAdd("h",-1,Now())

    If that doesn't work then describe the error and show examples of the data in the text field.

    Servus
    Karl
    Access News
    Access DevCon

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.