DateDiff Time

B

blink

Hello,
I'm trying to get a DateDiff expression in a query to result the subtraction
of time2 and time1, but when in the query the result doesn't showup until its
clicked and is negative. Here is the expression DateDiff ("n", [time1],
[time2]) . I'm a newb at access so any info would greatly appreciated.
 
J

John Vinson

Hello,
I'm trying to get a DateDiff expression in a query to result the subtraction
of time2 and time1, but when in the query the result doesn't showup until its
clicked and is negative. Here is the expression DateDiff ("n", [time1],
[time2]) . I'm a newb at access so any info would greatly appreciated.

Where are you putting the expression? What is it you're "clicking"?

DateDiff("n", [Time1], [Time2]) will subtract Time1 from Time2.

John W. Vinson[MVP]
 
B

blink

Hi John,

The expression is being put into a query based off of the "TimeTable". What
I have done was, drag and dropped the "time1", "time2", and the "total" field
from that table and wrote the expression on the "total" field that I dropped
into the query.
One thing that I have seen is that I receive a Syntax Error when trying to
select the the "TimeTable" in the "Table:" combo box for the Select Query.
Heres the error, "Syntax error (comma) in query expression
'timequery.[DateDiff("n",[time2], [time1])]'.
Now I am just confused.

John Vinson said:
Hello,
I'm trying to get a DateDiff expression in a query to result the subtraction
of time2 and time1, but when in the query the result doesn't showup until its
clicked and is negative. Here is the expression DateDiff ("n", [time1],
[time2]) . I'm a newb at access so any info would greatly appreciated.

Where are you putting the expression? What is it you're "clicking"?

DateDiff("n", [Time1], [Time2]) will subtract Time1 from Time2.

John W. Vinson[MVP]
 
J

John Vinson

Hi John,

The expression is being put into a query based off of the "TimeTable". What
I have done was, drag and dropped the "time1", "time2", and the "total" field
from that table and wrote the expression on the "total" field that I dropped
into the query.
One thing that I have seen is that I receive a Syntax Error when trying to
select the the "TimeTable" in the "Table:" combo box for the Select Query.
Heres the error, "Syntax error (comma) in query expression
'timequery.[DateDiff("n",[time2], [time1])]'.
Now I am just confused.

It sounds like you're mixing levels. The Total field SHOULD NOT EXIST
in your Table, period. It's redundant, since it can be derived from
the Time1 and Time2 fields; if you need to see it on a Form or Report,
or use it for filtering or sorting, just create a Query using it as a
calculated field.


John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top