Can you help with this one?
SUM fails - Data type mismatch in criteria expretion
SELECT [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
[Last Name], Sum([Time Keeping Base Report].[Total Hours]) AS [SumOfTotal
Hours]
FROM [Time Keeping Base Report]
GROUP BY [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
[Last Name];
works ok
SELECT [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
[Last Name], [Time Keeping Base Report].[Total Hours]
FROM [Time Keeping Base Report]
GROUP BY [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
[Last Name], [Time Keeping Base Report].[Total Hours];
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/201001/1
|
|
0
|
|
|
|
Reply
|
trevorC
|
1/21/2010 3:57:46 AM |
|
Hi Trevor
My guess is that the field [Total Hours] is storing the numeric expression
of the hours as a string.
Check the table specs under design mode.
Also try:
SELECT [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
[Last Name], Sum(CDbl([Time Keeping Base Report].[Total Hours])) AS
[SumOfTotal
Hours]
FROM [Time Keeping Base Report]
GROUP BY [Time Keeping Base Report].[First Name], [Time Keeping Base
Report].
[Last Name];
Also since in typical data sets there is far less repetition of last names
than first names, the group by should first group on last name.
Regards
Kevin
"trevorC via AccessMonster.com" <u44860@uwe> wrote in message
news:a26c816a7e4ba@uwe...
> Can you help with this one?
>
> SUM fails - Data type mismatch in criteria expretion
>
> SELECT [Time Keeping Base Report].[First Name], [Time Keeping Base
> Report].
> [Last Name], Sum([Time Keeping Base Report].[Total Hours]) AS [SumOfTotal
> Hours]
> FROM [Time Keeping Base Report]
> GROUP BY [Time Keeping Base Report].[First Name], [Time Keeping Base
> Report].
> [Last Name];
>
> works ok
> SELECT [Time Keeping Base Report].[First Name], [Time Keeping Base
> Report].
> [Last Name], [Time Keeping Base Report].[Total Hours]
> FROM [Time Keeping Base Report]
> GROUP BY [Time Keeping Base Report].[First Name], [Time Keeping Base
> Report].
> [Last Name], [Time Keeping Base Report].[Total Hours];
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/201001/1
>
|
|
0
|
|
|
|
Reply
|
kc
|
1/21/2010 4:27:35 AM
|
|
Perhaps you should provide the data type of [Total Hours]. When you view this
in datasheet, it the column left or right-aligned?
Is [Time Keeping Base Report] a table or query? I can't tell from the name.
--
Duane Hookom
Microsoft Access MVP
"trevorC via AccessMonster.com" wrote:
> Can you help with this one?
>
> SUM fails - Data type mismatch in criteria expretion
>
> SELECT [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
> [Last Name], Sum([Time Keeping Base Report].[Total Hours]) AS [SumOfTotal
> Hours]
> FROM [Time Keeping Base Report]
> GROUP BY [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
> [Last Name];
>
> works ok
> SELECT [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
> [Last Name], [Time Keeping Base Report].[Total Hours]
> FROM [Time Keeping Base Report]
> GROUP BY [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
> [Last Name], [Time Keeping Base Report].[Total Hours];
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/201001/1
>
> .
>
|
|
0
|
|
|
|
Reply
|
Utf
|
1/21/2010 4:43:01 AM
|
|
Your earlier posting tells me that Total Hours is a TEXT field (column). You
need to the TOTAL Minutes field that you are generating in the base query.
SUM([Total Minutes])\60 as TotalHours
SUM([Total Minutes]) Mod 60 as RemainingMinutes
IF you wanted that all as hours and minutes in a string you could use the
following expression to generate something like "69:12" - a string indicating
69 hours and 12 minutes.
SUM([Total Minutes])\60 & Format(SUM([Total Minutes]) Mod 60,"\:00")
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
trevorC via AccessMonster.com wrote:
> Can you help with this one?
>
> SUM fails - Data type mismatch in criteria expretion
>
> SELECT [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
> [Last Name], Sum([Time Keeping Base Report].[Total Hours]) AS [SumOfTotal
> Hours]
> FROM [Time Keeping Base Report]
> GROUP BY [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
> [Last Name];
>
> works ok
> SELECT [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
> [Last Name], [Time Keeping Base Report].[Total Hours]
> FROM [Time Keeping Base Report]
> GROUP BY [Time Keeping Base Report].[First Name], [Time Keeping Base Report].
> [Last Name], [Time Keeping Base Report].[Total Hours];
>
|
|
0
|
|
|
|
Reply
|
John
|
1/21/2010 7:01:08 PM
|
|
|
3 Replies
607 Views
(page loaded in 0.245 seconds)
Similiar Articles: to find the difference between time - microsoft.public.excel ...how to calculate total time in query - microsoft.public.access ... Difference between sum and groupby in query time - microsoft ... how to calculate total time in query ... update query based on date difference - microsoft.public.access ...Difference between sum and groupby in query time - microsoft ... No_Of_Visit,sum(amount)from customer group by ... SQL Date query for difference in ... ... Linking Same Tables (Current/Previous) in a Query / Sum is ...... YTD Total between the two,to determine the difference. I have the tables linked via 2 fields.I group by the two fields, and sum on ... The next time I went intothe Query ... Create a Query that Prompts for Date and Time - microsoft.public ...... Sum(CallDirection="OUT")) AS [Out Calls] , Abs(Sum ... Forms]![frmWeeklyReport]![txtEndDate]))) GROUP BY ... Reference a Date and Time in Query - microsoft.public.access ... Counting Days between dates - microsoft.public.access.queries ...... LastPayment, Date()) BETWEEN T.StartDiff AND T.EndDiff Group By Q ... 90 $75 This query uses the computed date difference between ... Duration Calculator: Time between ... Calculate Variance In Crosstab - microsoft.public.access ...Calculate Difference in ... Crosstab Query - Group by ... GROUP to SUM under the calculate ... Help: Creating a Variance column within a Column Group ... by using a query ... sum in two tables to calculate QOH - microsoft.public.access ...... totals query with the > group by the item no and a sum ... sum in two tables to calculate QOH - microsoft.public.access ... I'm trying to find the differences between two ... running difference between adjacent records in report - microsoft ...I need to calculate the "in-between-time" for two records. ... This is sort of the opposite of a running sum ... at 12:45 p.m. > > I need to calculate the difference between ... Difference from previous week - report - microsoft.public.access ...... need it, either as a calculated field in a Query or ... for AMOUNT1, total for AMOUNT2 etc. using =sum ... Time difference between New York time and other time zones; Display a ... Group by Range in Crosstab Query - microsoft.public.access.queries ...Query Based on Time Rane and Date Range - microsoft.public.access ... Group by Range in Crosstab Query ... Crosstab Query - Group by Month and Year ... text ) TRANSFORM Sum ... Sum data by using a query - Access - Office.com... an aggregate function in Access to sum the data in a query ... row appears in the design grid and Group By ... see the results, and then save the query. Note The next time ... SQL GROUP BY StatementThe GROUP BY Statement. The GROUP BY statement is used in ... Now we want to find the total sum (total order) of each customer. We will have to use the GROUP BY statement to ... SQL: Sum of difference of motor run time in a query - programming ...I am looking for a query which would take the difference of time between two signals ... type int" when I run a simple query .. Select id , SUM (transtime) from table1 group by ... Selecting records between two date range queryQuery for Getting records between two years, month or date ... in readable format including time Difference in days between ... I want to find the sum between two given ... The Database Programmer: GROUP BY, HAVING, SUM, AVG, and COUNT(*)GROUP BY, HAVING, SUM, AVG, and COUNT(*) ... The Fun Begins With GROUP BY. The query above is fine, but ... even if they had sales before that time 7/22/2012 3:04:10 AM
|