Count Function in Query design view

The type mismatch is coming from the highlighted part of the SQL statement:

SELECT [Promo count].PromoNo, [Promo count].[# of Demos], Count(DemoOrder.Status) AS CountOfStatus,
[DemoOrder]![Status]/[Promo count]![# of Demos] AS Percentage
FROM [Promo count] INNER JOIN DemoOrder ON [Promo count].PromoNo = DemoOrder.PromoNo
GROUP BY [Promo count].PromoNo, [Promo count].[# of Demos], [DemoOrder]![Status]/[Promo count]![# of Demos]
HAVING (((Count(DemoOrder.Status))="E"));

You can't divide the status (a string) by a number. Hence the type mismatch.

I tried the following query which at least does not generate errors (does it generate the results that you are looking for??)
Code:
SELECT [Promo count].PromoNo, [Promo count].[# of Demos], Count(DemoOrder.Status) AS CountOfStatus, 
CountOfStatus/[# of Demos] AS Percentage
FROM [Promo count] INNER JOIN DemoOrder ON [Promo count].PromoNo = DemoOrder.PromoNo
WHERE DemoOrder.Status = "E"
GROUP BY [Promo count].PromoNo, [Promo count].[# of Demos]

Are we getting closer?

- g
 
You are right, it did not error and it looks like it worked! Thanks for the help guys! I just had my boss over here and even he couldn't figure it out. We tried to do it another way, but that still didn't work. Everything looks good so far. I'll have to double check everything with other data though. Thanks!
 

Users who are viewing this thread

Back
Top Bottom