Data type mismatch in criteria expression (1 Viewer)

jpl458

Well-known member
Local time
Today, 06:42
Joined
Mar 30, 2012
Messages
1,038
I am building this query in the grid. The table is:

1663525978924.png


the grid is

1663526094343.png


If I run this query without the count, it runs fine, but when I add the count function I get

1663526248829.png


The field in the table is short text. I don't see how there is data type mismatch when I add the count.
 
Last edited:

June7

AWF VIP
Local time
Today, 05:42
Joined
Mar 9, 2014
Messages
5,474
But you are applying "Adam" text criteria to an aggregate calculated number value. If you want to filter by 1stcontactname field, don't do that in the same column you do Count. Use some other field for the Count or use Count(*).

Applying filter criteria to an aggregate calculation field will invoke a HAVING clause. Switch to SQLView to see query SQL statement.

WHERE filters records before aggregation, HAVING filters after aggregation.
 
Last edited:

GPGeorge

Grover Park George
Local time
Today, 06:42
Joined
Nov 25, 2004
Messages
1,873
But you are applying "Adam" text criteria to an aggregate calculated number value. If you want to filter by 1stcontactname field, don't do that in the same column you do Count. Use some other field for the Count or use Count(*).

Applying filter criteria to an aggregate calculation field will invoke a HAVING clause. Switch to SQLView to see query SQL statement.
To further what June7 pointed out, the result of the Count(1stContactName) will be a number, 1, or 2 or 3 or 9,000.

You want to match the selected name "Adam", not the number of Adams.
 

mike60smart

Registered User.
Local time
Today, 14:42
Joined
Aug 6, 2017
Messages
1,911
You also appear to have Repeating Group ie

1st Contact
2nd Contact
3rd Contact
4th Contact

These Contact Names should be records in a Related table vice Fields in the Table.
 

jpl458

Well-known member
Local time
Today, 06:42
Joined
Mar 30, 2012
Messages
1,038
But you are applying "Adam" text criteria to an aggregate calculated number value. If you want to filter by 1stcontactname field, don't do that in the same column you do Count. Use some other field for the Count or use Count(*).

Applying filter criteria to an aggregate calculation field will invoke a HAVING clause. Switch to SQLView to see query SQL statement.

WHERE filters records before aggregation, HAVING filters after aggregation.
Thanks
 

Users who are viewing this thread

Top Bottom