Hi All, I wonder if anybody can help, I have a search page with two field,
'cboLeadStatus' and 'cboTSRs' that pulls records from tblLeadDetails the:
cboLeadStatus values are (Busy, Not called, Not interested, etc...) cboTSRs
values are (John,Peter,Steve, Etc...) pulling all records that are 'Not called'
for let say John with a COUNT value, works fine!, but when I want to pull all
'Not called' for all values of the cboTSRs, the COUNT is wrong, an example
like: List of Not called leads: ------------------------------------ TSR -
COUNT John ---------------30 Peter --------------45 Steve -------------25
------------------------------------ Total leads: 100 I am attaching the
pages/codes:

TSRsLeadStatus.cfm
---------------------------------
<cflock scope="Session" type="ReadOnly" timeout="30" throwontimeout="no">
<cfset
MM_Username=Iif(IsDefined("Session.MM_Username")," Session.MM_Username",DE(""))>
<cfset
MM_UserAuthorization=Iif(IsDefined("Session.MM_Use rAuthorization"),"Session.MM_U
serAuthorization",DE(""))>
</cflock>
<cfif MM_Username EQ "" OR MM_UserAuthorization EQ "" OR
ListFind("50,99",MM_UserAuthorization) EQ 0>
<cfset MM_referer=CGI.SCRIPT_NAME>
<cfif CGI.QUERY_STRING NEQ "">
<cfset MM_referer=MM_referer & "?" & CGI.QUERY_STRING>
</cfif>
<cfset MM_failureURL="/unauthorised_user_page.htm?accessdenied=" &
URLEncodedFormat(MM_referer)>
<cflocation url="#MM_failureURL#" addtoken="no">
</cfif>
<cfparam name="FORM.cboLeadStatus" default="">
<cfparam name="FORM.LeadStatus" default="1">
<cfparam name="FORM.cboTSRs" default="">

<cfquery name="rsTSRsLeadStatus" datasource="Leads">
SELECT EmpName, LeadStatus, ID, ID AS ID_field
FROM tblLeadDetails
WHERE EmpName <>'Na'
<CFIF form.cboLeadStatus IS NOT "">
AND LeadStatus='#form.cboLeadStatus#'
</CFIF>
<CFIF form.cboTSRs IS NOT "">
AND EmpName='#form.cboTSRs#'
</CFIF>
ORDER BY EmpName ASC
</cfquery>

<cfquery name="TSRsStatusCount" dbtype="query">
SELECT COUNT(LeadStatus) AS TotalLeads
FROM rsTSRsLeadStatus
WHERE EmpName='#rsTSRsLeadStatus.EmpName#'
</cfquery>

<cfquery name="rsLeadStatus" datasource="Leads">
SELECT LeadStatus
FROM tblLeadStatus
ORDER BY LeadStatus ASC
</cfquery>
<cfquery name="rsTSRs" datasource="Windfall">
SELECT PhoneName
FROM tblEmployees
WHERE Security_Level < 50 AND PhoneName <> 'Na' AND Inactive=0
ORDER BY PhoneName ASC
</cfquery>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>TSRs lead status</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #d9e5f6;
margin-top: 5px;
}
-->
</style>
<link href="/trio.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 { color: #666666;
font-weight: bold;
}
.style3 { color: #0066CC;
font-weight: bold;
}
.style6 {
color: #FFFFFF;
font-size: 14px;
}
.style7 { color: #FFFFFF;
font-weight: bold;
}
.style8 {font-size: 16px}
.style11 {font-size: 14px}
-->
</style>

</head>

<body>
<table width="30%" border="0" align="center" cellpadding="0" cellspacing="0"
bgcolor="#FFFFFF" class="box2">
<tr><form name="form" method="post">
<td width="9%" align="center" valign="middle"> <div
align="right"><strong>Status: </strong></div></td>
<td width="34%" align="center" valign="top"><div align="left">
<select name="cboLeadStatus">
<option value="">All</option>
<option selected
value="<cfoutput>#FORM.cboLeadStatus#</cfoutput>"><cfoutput>#FORM.cboLeadStatus#
</cfoutput>
<cfoutput query="rsLeadStatus">
<option
value="#rsLeadStatus.LeadStatus#">#rsLeadStatus.Le adStatus#</option>
</cfoutput>
</select>
</div></td>
<td width="10%" align="right" valign="middle"><div
align="right"><strong>TSR:

</strong></div></td>
<td width="28%" valign="middle"><select name="cboTSRs">
<option value="">All</option>
<option selected
value="<cfoutput>#FORM.cboTSRs#</cfoutput>"><cfoutput>#FORM.cboTSRs#</cfoutput>

<cfoutput query="rsTSRs">
<option value="#rsTSRs.PhoneName#">#rsTSRs.PhoneName#</option>
</cfoutput>
</select></td>
<td width="19%" align="center" valign="bottom"> <div align="left">
<input type="submit" name="Submit" value="Search">
</div></td>
</form> </tr>
</table><br><br><br>
<CFIF IsDefined("form.submit") AND IsDefined("form.cboLeadStatus") AND
IsDefined("form.cboTSRs")>
<cfinclude template="/manager/leads/TSRsLeadStatusResults.cfm">

<CFELSE><br>
<div align="center" class="footer style8">There are no records to show
</div>

</CFIF>
</body>
</html>

TSRsLeadStatusResults.cfm
--------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #d9e5f6;
}
-->
</style>
<link href="/trio.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="30%" border="0" align="center" cellpadding="0" cellspacing="0"
class="box2">
<tr class="label">
<td width="30%"><div align="left"><strong>TSR</strong></div></td>
<td width="15%"><div align="center"><strong>COUNT</strong></div></td>
</tr>
<cfoutput query="rsTSRsLeadStatus" group="EmpName">
<tr valign="middle" bgcolor="#IIf(CurrentRow Mod 2, DE('FFFFFF'),
DE('F1F1F1'))#" class="medium" onmouseover="this.style.color='red';
this.style.backgroundColor='gold'" onmouseout="this.style.color='';
this.style.backgroundColor=''">
<td><div align="left"
class="style2">#rsTSRsLeadStatus.EmpName#</div></td>
<td><div align="center"
class="style3">#TSRsStatusCount.TotalLeads#</div></td>
</tr>
</cfoutput>
</table>
<table width="30%" border="0" align="center" cellpadding="0" cellspacing="0"
class="box2">
<tr bgcolor="#003063">
<td width="30%"><div align="justify"><strong> </strong>
</div> <div align="right" class="style7">
<div align="right" class="style11">Total leads </div>
</div></td>
<td width="15%"><div align="center"><strong><cfoutput><span class="style6
style8">#rsTSRsLeadStatus.RecordCount#</span></cfoutput></strong></div></td>
</tr>
</table>


</body>
</html>