Re: Query Problem - Two or More Records
- From: "John Spencer" <spencer@xxxxxxxxx>
- Date: Fri, 31 Mar 2006 08:34:52 -0500
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
.
- Follow-Ups:
- Re: Query Problem - Two or More Records
- From: Rick_C
- Re: Query Problem - Two or More Records
- Prev by Date: Re: Equilevant of Oracle for optional records
- Next by Date: Re: shorten an SQL statement to work in VB.net
- Previous by thread: Re: Prompting several different criteria from a form (Query by Form)
- Next by thread: Re: Query Problem - Two or More Records
- Index(es):
Relevant Pages
|
|