Query Calculation Based on Current Time

brian7268

Registered User.
Local time
Today, 01:49
Joined
Mar 19, 2013
Messages
20
I have a database that has 2 forms. After submitting the first form, the user should complete the second form within 24 hours. The first form stores the Date/Time the form was submitted. I want to be able to run a query and have a column in the query that is "Time Remaining". In non-technical terms, this column would be:

Date/Time form submitted + 24 hours - Current date/time

Any suggestions?

Thanks!
 
Date/Time values are stored in Access tables as floating point numbers and one day is equal to one (1).

So your math is exactly what you wrote, except . . .
Code:
Form1SubmittedDateTime + 1 - Now()

hth
 
Thank you very much for the reply, lagbolt! I think I misrepresented my question. I was not so concerned the formula as how do you populate a column in a query with a formula? Do I need VBA for that or is that built into SQL?
 
In the query design grid you add a column and in the first row you type . . .
Code:
FieldName: DateField + 1 - Now()
. . . where,
1) FieldName is the output name for the calculated field,
2) DateField is the date field you want to use and it must be present in one the tables that appears in the query

And Now() is a function that returns the current DateTime.
 

Users who are viewing this thread

Back
Top Bottom