Counting Date and Time with variables

Scottie31

Registered User.
Local time
Today, 09:32
Joined
Jan 11, 2006
Messages
30
I am currently running a query which shows a date and time for several products:

Product 1 Product 2 Product 3 Product 4
01/01/07 12:00 01/01/07 15:25 01/01/07 15:25 01/01/07 17:36


From this information I need to count each Product unless the date & time is equal or within 30 minutes.

Any help on this one would be greatly appreciated.
 
Hey

I am currently running a query which shows a date and time for several products:

Product 1 Product 2 Product 3 Product 4
01/01/07 12:00 01/01/07 15:25 01/01/07 15:25 01/01/07 17:36


From this information I need to count each Product unless the date & time is equal or within 30 minutes.

Any help on this one would be greatly appreciated.

Do you mean within 30 minutes of when you run the query... or within 30 minutes of each other... or within 30 minutes of product 1???
 
Last edited:
You could try this

This will put a 1 in the colmun if the time is within 30 minutes of now and a zero in the column if it is greater. Then you simply sum it to get a total count.

CountProduct1: IIF(DateDiff("n",[Product 1],Now())<=30, 1, 0)

If you want to reference it against someting other than now... just change the Now() to one of your other fields...

CountProduct2: IIF(DateDiff("n",[Product 2],[Poduct 1])<=30, 1, 0)

Just a thought.
 

Users who are viewing this thread

Back
Top Bottom