Count with multiple criteria (3) on a query (1 Viewer)

Garuban

New member
Local time
Today, 01:09
Joined
May 25, 2023
Messages
9
You can leave the apostrophes. They only have to be doubled in the string.
Code:
DCount("*","GP Data","[EmployeeName] = '" & Replace([EmployeeName], "'", "''") & "'")

Does the query need to remain editable?
If not, I would use a subselect instead of DCount, then you don't have to bother with text composition.
Code:
SELECT
     [GP Data].EmployeeName, [GP Data].[Week End Date]
     , (select count(*) from [GP Data] as X where X.EmployeeName = [GP Data].EmployeeName) AS [RecCount]
FROM
     [GP Data]
Yes it needs to remain editable,

As of now the formula is working, but taking multiple minutes to run the query, and that's my only concern now


Thanks for helping
 

Users who are viewing this thread

Top Bottom