Displaying Records Entered in Prior 10 minutes (1 Viewer)

themurph2000

Fat, drunk, and stupid
Local time
Today, 12:51
Joined
Sep 24, 2007
Messages
181
I apologize if this has been asked already, but I couldn't find the answer.

I have a field in a table that timestamps the date and time in which a record is entered. (using general date format: mm/dd/yyyy hh:mm AM/PM) I want to put a calculation in my query that will display all records that had been entered in the prior 10 minutes, so that a person wouldn't have to sort through all records entered for a particular day.

I know the Now() function could be of use here, but I wasn't sure how to set up the rest of the calculation so that 10 minutes (as opposed to days, months, etc) were subtracted as the criteria. Any suggestions?

Thanks
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 10:51
Joined
Aug 30, 2003
Messages
36,124
Check out the DateAdd function in help.
 

themurph2000

Fat, drunk, and stupid
Local time
Today, 12:51
Joined
Sep 24, 2007
Messages
181
Check out the DateAdd function in help.


Perfecto. Took me a minute or two to mess with it, but it works. Thanks!

For those who wanted the answer, use the criteria >=DateAdd("n", -10, Now()) to grab all records created within the last 10 minutes, assuming you have a field that timestamps each new record in General Date format (mm/dd/yyyy, hh:mm AM/PM)
 
Last edited:

dkinley

Access Hack by Choice
Local time
Today, 12:51
Joined
Jul 29, 2008
Messages
2,016
Just posting another solution that I've used in the past ...

Code:
DateDiff("n",[DateField],Now()) < 10

-dK
 

Users who are viewing this thread

Top Bottom