Syntax to return count of specific records to form

cft

Registered User.
Local time
Today, 16:48
Joined
Dec 31, 2001
Messages
52
I am creating a Data Entry Form for Employee evaluations. On the form I have a calculated field called "Record". This field is to show the cumulative number of audits per employee within a given month.
Each Supervisor has Employees whom they evaluate 12 times a month. The form confirms the Employee ID and should tell the Supervisor which number evaluation they are about to enter. If a Supervisor "pulls" an employee record and it shows 12 records,they are finished with that employee's audits for the month. What I need to build is the Expression that will: match the EmpID to the number of Employee-specific records within a Calendar month. The field is set up to read,"Record [Calculated Field] of 12". The form is based on a query "QryAudPerf" and the query pulls data from the "TblAudPerf" where all the entries reside. Any help will be gratefully received - I am perplexed.
 
To perhaps provide an example to serve as a starting point, create a new query in the Northwind database and copy/paste the following SQL to it.

When you run it you'll be asked to provide a month, e.g. 4 = April, 8 = August, and it will return the number of orders credited to each employee during the specified month. Hopefully you can translate the technique to your scenario.

SELECT Orders.EmployeeID, Count(Orders.EmployeeID) AS CountOfEmployeeID
FROM Orders
WHERE (((Month([OrderDate]))=[Enter month as digit]))
GROUP BY Orders.EmployeeID;
 
Jon - Thank you for getting me into the right arena. I am still having trouble getting the syntax correct.
After about 50 attempts to reconfigure the structure of the statement, I am getting Error messages. Most recently 3075 regarding a missing operator in the WHERE statement.
I am using the following:
Table = TblAudPerf (Audit Performance)
(Contains: Record Date (date of Data Entry) / Event Date (Date Audit Occurred) / ... / EmpID (Employee ID) /
(There are other fields in the table, but Event Date and EmpID are the ones being referred to in the SELECT statement)

There is a Query built exactly from TblAudPerf called QryAudPerf and a Form FrmAudPerf built from the Query.
On the Form is a Field for EmpID, (among others) and a Calculated Field called: Record _#_ of 12.
The SELECT statement is supposed to Match the Employee ID (EmpID) entered into the EmpID text box to the TblAudPerf
and the Event Date (entered into the Event Date box) in the same table.
The idea is to count the number of existing entries for the EmpID and add +1 (for the current number of entry) where the Event Date (month) = the "month" date entered into the pop-up selection field you mentioned in your reference to the Northwind example.

I am struggling, in part, because I do not know where to enter the SELECT statement. I have tried both in the Field and the Criteria locations with no success.

I have also used around 50 derivations of:
(SELECT TblAudPerf.EmpID, Count (TblAudPerf.EmpID) AS CountOfEmpID
FROM TblAudPerf
WHERE (((Month(TblAudPerf.Event Date)) = [Enter Month as Digit])))
Where the month found in the Event Date field of TblAudPerf is equal to (month entered into pop-up box).
When I tried the form you provided in Northwind I got syntax errors like 3075.
In the QryAudPerf Field or Criteria locations I get "Syntax Error in FROM clause messages."
I also get various other Syntax and missing operator or parenthesis messages.

If you can provide any further suggestions, I will be grateful.
Thanks for taking time from your day to assist me with this problem.
 

Users who are viewing this thread

Back
Top Bottom