Re: Query Problem - Two or More Records



Try changing the sub-query in the criteria to

In (SELECT [EmployeeNumber]
FROM [tblECDEmployeeInvolved]
WHERE [IncidentDate] Between
[Forms]!frmEmployeeComplaintDialogBox]![BeginningDate]
And [Forms]!frmEmployeeComplaintDialogBox]![EndingDate]
GROUP BY [EmployeeNumber] HAVING Count (*) > 2)

This returns records where the employee had MORE than 2 incidents in the
specified time frame.

Your sub-query was returning any employee that had an employee number
greater than 2 and had more than 2 incidents in the entire table.


"Rick_C" <RickC@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:52AAF883-3827-499A-A6C5-7A70D9C96EE6@xxxxxxxxxxxxxxxx
I am trying to run a query where I can determine when an employee gets more
than 2 complaints within a certain date range.

The fields in my query are:

IncidentDate
EmployeeNumber

In the INCIDENTDATE column, I set the criteria as:

Between [Forms]!frmEmployeeComplaintDialogBox]![BeginningDate] And
[Forms]!frmEmployeeComplaintDialogBox]![EndingDate]

In the EMPLOYEENUMBER column, I set the criteria as:

In (SELECT[EmployeeNumber] FROM [tblECDEmployeeInvolved] WHERE
[EmployeeNumber] > 2 GROUP BY [EmployeeNumber] HAVING Count (*) > 2)

I am not getting a correct response. I am showing employees that have two
or
more complaints but not just within the specified date range.

Any help would be greatly appreciated.

Thank you in advance for your response.

Rick


.



Relevant Pages

  • Re: Mutli value field? - Memo field?
    ... the perfromance of an employee against set criteria. ... 20 criteria to be measured by the person monitoring the employee's ... I guess I need a memo field for MeasuresFailed, ...
    (microsoft.public.access.forms)
  • Re: Report parameters
    ... It looks to me like you should add some option boxes on to you criteria ... selection form with the options All, Range, Single. ... I have a button called cmdfilter, two option boxes - 1 called optDateRange ... > PK from the Employee table); ...
    (microsoft.public.access.reports)
  • Re: Not like
    ... The field is text and is used to store notations or employee status and ... number and if not scheduled it will have the word Off and that criteria work ... for that field to exclude the employee Off or not scheduled. ...
    (microsoft.public.access.queries)
  • Re: Query expression Help
    ... I neglected to note that you were putting a Criteria on ... Don't you just want to show the sum of employee time for each ... <MS ACCESS MVP> ... Criteria: "Bill Black" ...
    (microsoft.public.access.gettingstarted)
  • Re: beep beep
    ... Blunt and Opaque wrote: ... dartboard - you still get points if you get close, ... (Speaking both as an employee and as an employer.) ... detail about precisely what criteria have to be met. ...
    (soc.singles.moderated)