I would like to run a query that looks at an invoice and counts the number of each unique codes.
I have tried by adding the table, then the field that will be used as the search criteria and then using an iif statement to create the two fields.
Fields: invoice created fields: NumberOf7, NumberOf1
Numberof7:IIF([RespCode]=7,count([RespCode],0) and then to get the other number Numberof1:IIF([RespCode]=1,count([RespCode],0)
but when I run it i get the error "your query does not include the specified expression 'invoice' as part of an aggregate function.
I am trying to do this because in a form based on a summary query I want to be able to show the number of 7 an 1's but if i add it to the query it will just create another line.