Hi folks,
I am writing a query that will highlight aggregations within time periods.
So I have a full date_time field on each row (TRANSACTION_DATE_TIME) and a date only field as well (Last Contact Date). I want to be able to use the time element (regardless of the date) and perform calculations using time segments.
E.g. I'd like to perform an aggregation on all where time is between 00:00 and 07:00.
<b>TimeValue(Format([DATA]![TRANSACTION_DATE_TIME]-([DATA]![Last Contact Date]),"Short Time"))</b> gets me the time element fine, but I cannot seem to set the criteria to make sure the query is working without getting a Data Mismatch error.
I've tried as a string, as a date, as an integer and it doesn't like it. I pasted the results into Excel and the date was returned as 00-Jan-1900... so I was thinking that Access knew that the returned result wasn't a date.
So I tried adding a day onto the transaction date, or subtracting a day from the Last Contact Date... still not returning a datetime result I can set criteria on.
I have also tried converting it to a string and running a <b>Left(Time, 2) between</b> criteria.
In my experience I've usually over-complicated things... so what am I missing? Any ideas?
I am writing a query that will highlight aggregations within time periods.
So I have a full date_time field on each row (TRANSACTION_DATE_TIME) and a date only field as well (Last Contact Date). I want to be able to use the time element (regardless of the date) and perform calculations using time segments.
E.g. I'd like to perform an aggregation on all where time is between 00:00 and 07:00.
<b>TimeValue(Format([DATA]![TRANSACTION_DATE_TIME]-([DATA]![Last Contact Date]),"Short Time"))</b> gets me the time element fine, but I cannot seem to set the criteria to make sure the query is working without getting a Data Mismatch error.
I've tried as a string, as a date, as an integer and it doesn't like it. I pasted the results into Excel and the date was returned as 00-Jan-1900... so I was thinking that Access knew that the returned result wasn't a date.
So I tried adding a day onto the transaction date, or subtracting a day from the Last Contact Date... still not returning a datetime result I can set criteria on.
I have also tried converting it to a string and running a <b>Left(Time, 2) between</b> criteria.
In my experience I've usually over-complicated things... so what am I missing? Any ideas?