If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Time() - 5 minutes
I have an update query that adds the time to a field as well as various other
updates. I am trying to run a subsequent query that I am trying to get it to pull all records with the current date from the date field (no problem with portion), and with all records where the time field is within the last 5 minutes of the current time (This is the part I'm having problems). The reason for this is, it is a multi-user database, and this query will be sending e-mail messages out to individuals with an expiration date soon to expire, and I'm trying to put a limit on it, so they don't receive the same e-mail several times in one day. Any help would be greatly appreciated. -- Scott |
#2
|
|||
|
|||
Time() - 5 minutes
On Fri, 2 May 2008 10:39:00 -0700, Scott
wrote: I have an update query that adds the time to a field as well as various other updates. I am trying to run a subsequent query that I am trying to get it to pull all records with the current date from the date field (no problem with portion), and with all records where the time field is within the last 5 minutes of the current time (This is the part I'm having problems). The reason for this is, it is a multi-user database, and this query will be sending e-mail messages out to individuals with an expiration date soon to expire, and I'm trying to put a limit on it, so they don't receive the same e-mail several times in one day. Any help would be greatly appreciated. Take a look at the DateAdd() function. If the date field contains both the date and time, use Now() to get the current clock time, and DateAdd("n", -5, Now()) to get the time five minutes ago. The Time() function returns a pure time - in fact, a date/time value sometime on December 30, 1899, which is the zero point of the date/time system. A Date/Time value is a double float count of days and fractions of a day since midnight on that date; so 0.75 would be #12/30/1899 18:00:00#. -- John W. Vinson [MVP] |
#3
|
|||
|
|||
Time() - 5 minutes
I believe we are almost there, if i need all between now() and the last 5
minutes would the formula be as follows: between DateAdd("n", -5, Now()) and Now() I appreciate your help. -- Scott "John W. Vinson" wrote: On Fri, 2 May 2008 10:39:00 -0700, Scott wrote: I have an update query that adds the time to a field as well as various other updates. I am trying to run a subsequent query that I am trying to get it to pull all records with the current date from the date field (no problem with portion), and with all records where the time field is within the last 5 minutes of the current time (This is the part I'm having problems). The reason for this is, it is a multi-user database, and this query will be sending e-mail messages out to individuals with an expiration date soon to expire, and I'm trying to put a limit on it, so they don't receive the same e-mail several times in one day. Any help would be greatly appreciated. Take a look at the DateAdd() function. If the date field contains both the date and time, use Now() to get the current clock time, and DateAdd("n", -5, Now()) to get the time five minutes ago. The Time() function returns a pure time - in fact, a date/time value sometime on December 30, 1899, which is the zero point of the date/time system. A Date/Time value is a double float count of days and fractions of a day since midnight on that date; so 0.75 would be #12/30/1899 18:00:00#. -- John W. Vinson [MVP] |
Thread Tools | |
Display Modes | |
|
|