More SQL Syntax Problems re: Counting

cft

Registered User.
Local time
Today, 09:41
Joined
Dec 31, 2001
Messages
52
I think I am close, but cannot get this subform to bring up the information.
I have a form It has locations to enter an EmpID and an Event Date. Located on the form I have a Subform called Record. This displays the number of entries for XYZ Employee for the month entered as MM/DD/YY in the field "Event Date". (There are 12 entries per month and this tells the user which one they are about to enter) I have the subform "Record" attached to a Query ("QryRecord") I am using the following SQL: SELECT TblAudPerf.EmpID, Count(TblAudPerf.EmpID) AS CountOfEmpID
FROM TblAudPerf
WHERE (((Month([Event Date]))=[Enter Month as Digit])) AND ((([EmpID]))=Forms!FrmMasterHDAudPerf![EmpID])
GROUP BY TblAudPerf.EmpID;
There is a pop-up box which is supposed to allow the user to enter the month of the Event Date and then the form opens and allows the user to enter the "EmpID". At this time the Record Subform should populate the number of the current entry for the Employee. Problem is the subform comes up either blank, or "Name?". I have read nearly every post and tried them but keep getting syntax errors and, or no results. I need help! What am I doing wrong?
 
I got it. The correct SQL should have been:
SELECT Count(TblAudPerf.EmpID) +1 AS CountOfEmpID
FROM TblAudPerf
WHERE (((Month([Event Date]))=[Enter Month as Digit]) AND ((([EmpID]))= [Enter EmpID]))
GROUP BY TblAudPerf.EmpID;
This maps it to the correct location and accomplishes what I needed. Hope this helps someone who is faced with similar issues. I just about gave up!
 

Users who are viewing this thread

Back
Top Bottom