A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Time() - 5 minutes



 
 
Thread Tools Display Modes
  #1  
Old May 2nd, 2008, 06:39 PM posted to microsoft.public.access.queries
Scott
external usenet poster
 
Posts: 1,119
Default 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  
Old May 2nd, 2008, 07:36 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default 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  
Old May 2nd, 2008, 08:00 PM posted to microsoft.public.access.queries
Scott
external usenet poster
 
Posts: 1,119
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:11 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.