N
NewSysAdmin
I am having trouble with the count function in a parameter query. It returns
all 1s instead of counting the actual records. I believe the reason is
because it is grouping on the other fields and then getting confused when
it's trying to count. When I delete the group by from the fields, I get an
error message. Please help! I've been struggling with this for days.
Please see below SQL code. Thank you so much for any suggestions.
SELECT ([RMA/TR Tracking table].[Customer Model Code] & "-" & [RMA/TR
Tracking table].[Record ID#] & "-" & [RMA/TR Tracking table].[Two-digit
year]) AS [RMA Tracking #], [RMA/TR Tracking table].[Problem Code], [RMA/TR
Tracking table].[Two-digit year], Count([RMA/TR Tracking table].[Record ID#])
AS [CountOfRecord ID#]
FROM [RMA/TR Tracking table]
GROUP BY ([RMA/TR Tracking table].[Customer Model Code] & "-" & [RMA/TR
Tracking table].[Record ID#] & "-" & [RMA/TR Tracking table].[Two-digit
year]), [RMA/TR Tracking table].[Problem Code], [RMA/TR Tracking
table].[Two-digit year]
HAVING ((([RMA/TR Tracking table].[Problem Code])=[Enter Problem Code]));
all 1s instead of counting the actual records. I believe the reason is
because it is grouping on the other fields and then getting confused when
it's trying to count. When I delete the group by from the fields, I get an
error message. Please help! I've been struggling with this for days.
Please see below SQL code. Thank you so much for any suggestions.
SELECT ([RMA/TR Tracking table].[Customer Model Code] & "-" & [RMA/TR
Tracking table].[Record ID#] & "-" & [RMA/TR Tracking table].[Two-digit
year]) AS [RMA Tracking #], [RMA/TR Tracking table].[Problem Code], [RMA/TR
Tracking table].[Two-digit year], Count([RMA/TR Tracking table].[Record ID#])
AS [CountOfRecord ID#]
FROM [RMA/TR Tracking table]
GROUP BY ([RMA/TR Tracking table].[Customer Model Code] & "-" & [RMA/TR
Tracking table].[Record ID#] & "-" & [RMA/TR Tracking table].[Two-digit
year]), [RMA/TR Tracking table].[Problem Code], [RMA/TR Tracking
table].[Two-digit year]
HAVING ((([RMA/TR Tracking table].[Problem Code])=[Enter Problem Code]));