dbTalk Databases Forums  

Time Gap in a Query

comp.database.ms-access comp.database.ms-access


Discuss Time Gap in a Query in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Simon Bailey
 
Posts: n/a

Default Time Gap in a Query - 02-17-2004 , 01:47 PM






I am not an experienced user of SQL and have come across a problem in
my designing my system.
I have an entity tblfeedback, and the fields; DateLookedAt and
DateResolved. I am looking to display a query giving the gap in time
between these two dates. The data types in these fields are 'text'
rather than 'date/time' does this pose a problem?
Can anyone give me the code to create this query displaying these two
fields and an extra field displaying the time gap between the two
dates "TimeTakentoResolve".
Thanks for any help given.

Reply With Quote
  #2  
Old   
Ira Solomon
 
Posts: n/a

Default Re: Time Gap in a Query - 02-18-2004 , 08:38 PM






A simple query will do it.
The first 2 columns are just the date fields as is.
the third column is:
dif:
DateDiff("d",CDate([dtest]![DateLookedAt]),CDate([dtest]![DateResolved]))

The table name in my case is dtest. You need to put your table name
in there. This is more complex because the dates are text.
Thats why you need the CDate.
This give answer in days. if you use "h" you get it in hours.

Good Luck
Ira Solomon



On 17 Feb 2004 11:47:40 -0800, goatsupreme (AT) hotmail (DOT) com (Simon Bailey)
wrote:

Quote:
DateLookedAt


Reply With Quote
  #3  
Old   
Simon Bailey
 
Posts: n/a

Default Re: Time Gap in a Query - 02-27-2004 , 03:46 PM



Ira Solomon <isolomon (AT) solomonltd (DOT) com> wrote

Quote:
A simple query will do it.
The first 2 columns are just the date fields as is.
the third column is:
dif:
DateDiff("d",CDate([dtest]![DateLookedAt]),CDate([dtest]![DateResolved]))

The table name in my case is dtest. You need to put your table name
in there. This is more complex because the dates are text.
Thats why you need the CDate.
This give answer in days. if you use "h" you get it in hours.

Good Luck
Ira Solomon



On 17 Feb 2004 11:47:40 -0800, goatsupreme (AT) hotmail (DOT) com (Simon Bailey)
wrote:


Thanks very much Ira. That was very helpful and it worked! I have one
more question. Is it possible have have another field in the query to
put on my report showing an average of all the DateDiffs. Is this is
possible can anyone give me a hand with the SQL or code?

Many Thanks


Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.