Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

Total Record Count per Individual

Question posted by: hotflash (Member) on February 26th, 2008 08:02 PM
Hi CroCrew et. All,

I am currently working on a quick report that count a total of completed records per Individual. The code that I have will add up all Individual completed records and what I want is to get a total for each of the Individuals per month. For example,

CroCrew
....
....
Total = 2

Jim
....
....
Total = 2

Below is part of the show completed records that I used and wonder if you can help. This is my first time to try to put the code into the format that you and HOPE YOU IT WILL SHOW UP RIGHT. Thanks once again for your help.

Code: ( text )
  1. <TR BGCOLOR="CEEFFF">
  2.     <TD> <DIV ALIGN="CENTER">RECORD</DIV></TD>
  3.     <TD> <DIV ALIGN="CENTER"><STRONG>INDIVIDUAL</STRONG></DIV></TD>
  4.     <TD> <DIV ALIGN="CENTER"><STRONG>COMPLETE DATE</STRONG></DIV></TD>
  5.   </TR>
  6.  
  7.  
  8. <%
  9.  
  10. WHILE NOT RS.EOF
  11.    
  12. Response.Write("<TR>")
  13. Response.Write("<TD>" & RS("RecordID") & "&nbsp;</TD>")
  14. Response.Write("<TD>" & RS("Individual") & "&nbsp;</TD>")
  15. Response.Write("<TD>" & RS("CompleteDate") & "&nbsp;</TD>")
  16.  
  17.  
  18. Response.Write("</TR>")
  19.  
  20. strCount=strCount + 1
  21.  
  22. RS.MoveNext
  23. Wend
  24.  
  25. RS.Close
  26. Conn.Close
  27. set Conn = nothing
  28. set RS = Nothing
  29.  
  30. Response.Write("<FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">Total Records:   ")
  31.                       Response.Write("</FONT>")
  32.                         Response.Write("<FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#FF0000"" SIZE=""2"">")
  33.                         Response.Write(strCount)
  34.  
  35. %>
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
jeffstl's Avatar
jeffstl
Expert
328 Posts
February 27th, 2008
07:28 PM
#2

Re: Total Record Count per Individual
So did it work for you?

I did not see you post an actual question or problem you had.

I will point out that rather then loop through all your records you can get a total immediately from just using an SQL query.

http://www.w3schools.com/sql/func_count_ast.asp

Reply
hotflash's Avatar
hotflash
Member
85 Posts
February 29th, 2008
06:57 AM
#3

Re: Total Record Count per Individual
Hi Jeff,

I got the total records count for ALL individual show up correctly. What I want to do is to get a total count for EACH individual. Please see below and thanks for your help.

Current:
CroCrew
CroCrew
Jim
Jim

Total Records: 4

Want it to be:

CroCrew
....
....
Total = 2

Jim
....
....
Total = 2

Reply
DrBunchman's Avatar
DrBunchman
Moderator
555 Posts
February 29th, 2008
09:00 AM
#4

Re: Total Record Count per Individual
Hi Hotflash,

Jeff is right about getting the sql query to do the work for you. In order to get a count of each individual you can use the following simple query:

SELECT Individual, COUNT(CompleteDate) AS RecordCount FROM MyTable Group By Individual

If you want to put a condition in here then you can do so like this:

SELECT Individual, COUNT(CompleteDate) AS RecordCount FROM MyTable WHERE CompleteDate IS NOT NULL Group By Individual

Use this in your sql string then cycle through each of the records as you would before:

Code: ( text )
  1. While Not RS.eof
  2. Response.Write("<tr>")
  3. Response.Write("<td>" & RS("Individual") & "&nbsp;</td>")
  4. Response.Write("<td>" & RS("RecordCount ") & "&nbsp;</td>")
  5. Response.Write("</tr>")
  6. RS.MoveNext
  7. WEnd


Let us know how you get on,

Dr B

PS This sounds silly I know but you should keep all your html as lower case - although it won't affect you at the moment if you ever start using .NET you'll find your html won't validate because it's in uppercase. Just thought I'd let you know ;-)

Reply
idsanjeev's Avatar
idsanjeev
Familiar Sight
214 Posts
February 29th, 2008
09:12 AM
#5

Re: Total Record Count per Individual
Quote:
Originally Posted by hotflash
Hi Jeff,

I got the total records count for ALL individual show up correctly. What I want to do is to get a total count for EACH individual. Please see below and thanks for your help.

Current:
CroCrew
CroCrew
Jim
Jim

Total Records: 4

Want it to be:

CroCrew
....
....
Total = 2

Jim
....
....
Total = 2


Hi hotfalsh
Try this sql query in select statement

Code: ( text )
  1. SELECT YourColumn,yourcolumn, COUNT(*) TotalCount
  2. FROM YourTable
  3. GROUP BY YourColumn
  4. ORDER BY COUNT(*) ASC

thanks

Reply
hotflash's Avatar
hotflash
Member
85 Posts
March 1st, 2008
02:39 PM
#6

Re: Total Record Count per Individual
Hi idsanjeev and DrBunchman,

Your recommendations sound EXTREMELY GOOD however, I am having problem to try to integrate them into the actual code that I used because I have case statements, etc for different type of search as well.

Is there a way, I can send you the 2 files that I used (1 search option, 1 display search result) for your recommendations? Please advise or send me a PM message. Thanks once again for your outstanding support.

Reply
DrBunchman's Avatar
DrBunchman
Moderator
555 Posts
March 5th, 2008
08:38 AM
#7

Re: Total Record Count per Individual
Quote:
Originally Posted by hotflash
Hi idsanjeev and DrBunchman,

Your recommendations sound EXTREMELY GOOD however, I am having problem to try to integrate them into the actual code that I used because I have case statements, etc for different type of search as well.

Is there a way, I can send you the 2 files that I used (1 search option, 1 display search result) for your recommendations? Please advise or send me a PM message. Thanks once again for your outstanding support.


Hi Hotflash, have you managed to fix this yet or has idsanjeev helped you out?

Reply
idsanjeev's Avatar
idsanjeev
Familiar Sight
214 Posts
March 7th, 2008
07:30 AM
#8

Re: Total Record Count per Individual
Hi Hotflash
you can simply attached your file in post or pm

Reply
hotflash's Avatar
hotflash
Member
85 Posts
March 11th, 2008
12:50 AM
#9

Re: Total Record Count per Individual
Hi Sanjeev,

Below are the files that I used for this search and display reports accordingly.
The MS Access fields are defined as follows:

RecordID: AutoNumber and Primary Key
CompleteDate: Date/Time
ProjectType: Text
Network: Text
Individual: Text (First and Last Name)

Thanks once again for your outstanding support.

Code: ( text )
  1. <HTML>
  2. <HEAD>
  3. <TITLE>Homepage</TITLE>
  4.  
  5. <STYLE>
  6. table.MAIN { border: none; }
  7. table.MAIN TR TD { font-size: 14px; font-family: helvetica, helv, arial; }
  8. table.MAIN TR TH { font-size: 14px; font-family: helvetica, helv, arial; font-weight: bold;
  9.                    width: 350px; text-align: right; }
  10. </STYLE>
  11.  
  12. <SCRIPT>
  13. var msgs = new Array("",
  14.                                          "Enter Individual Name (Full or Partial Name):",
  15.                                          "Enter Project Type (Full or Partial):",
  16.                      "Enter Network (Full or Partial):",
  17.                      "Enter Region (Full or Partial):");
  18.  
  19. function setInfo( )
  20. {
  21.     var sts = document.xForm.SearchType;
  22.  
  23.     // set message according to searchtype:
  24.     for ( var n = 0; n < sts.length; ++n )
  25.     {
  26.         if ( sts[n].checked ) document.getElementById("SLABEL").innerHTML = msgs[n];
  27.     }
  28.     document.getElementById("SBOX").style.visibility = sts[0].checked ? "hidden" : "visible";
  29. }
  30. </SCRIPT>
  31.  
  32. </HEAD>
  33.  
  34. <BODY ONLOAD="jsClock()" BGCOLOR="#FFFFFF">
  35. <BR>
  36.  
  37. <TABLE CLASS="MAIN" CELLSPACING="0" CELLPADDING="4" C>
  38.  
  39. <DIV ALIGN ="LEFT">
  40.  
  41. <FORM ID="xForm" NAME="xForm" METHOD="post" ACTION="DisplayReports-Test.asp">
  42.  
  43.   <SCRIPT LANGUAGE="JavaScript" ID="jscal1xx">
  44.             var cal1xx = new CalendarPopup("testdiv1");
  45.             cal1xx.showNavigationDropdowns();
  46.     </SCRIPT>
  47.     <SCRIPT LANGUAGE="JavaScript">writeSource("jscal1xx");</SCRIPT>
  48.  
  49.     <SCRIPT LANGUAGE="JavaScript" ID="jscal2xx">
  50.             var cal2xx = new CalendarPopup("testdiv2");
  51.             cal2xx.showNavigationDropdowns();
  52.     </SCRIPT>
  53.     <SCRIPT LANGUAGE="JavaScript">writeSource("jscal2xx");</SCRIPT>
  54. <P></P>
  55.  
  56. <TR>
  57.     <TH ALIGN="right" VALIGN="top"><FONT FACE="HELVETICA,HELV,ARIAL" SIZE="2">Type of Search: </FONT></TH>
  58.     <TD>
  59.             <FONT FACE="HELVETICA,HELV,ARIAL" SIZE="2"><INPUT TYPE="radio" NAME="SearchType" VALUE="0" onClick="setInfo()"> All Completed Records <BR/> </FONT>
  60.         <FONT FACE="HELVETICA,HELV,ARIAL" SIZE="2"><INPUT TYPE="radio" NAME="SearchType" VALUE="1" onClick="setInfo()"> By Individual <BR/> </FONT>
  61.         <FONT FACE="HELVETICA,HELV,ARIAL" SIZE="2"><INPUT TYPE="radio" NAME="SearchType" VALUE="2" onClick="setInfo()"> By Project Type <BR/> </FONT>
  62.         <FONT FACE="HELVETICA,HELV,ARIAL" SIZE="2"><INPUT TYPE="radio" NAME="SearchType" VALUE="3" onClick="setInfo()"> By Network <BR/> </FONT>
  63.         <FONT FACE="HELVETICA,HELV,ARIAL" SIZE="2"><INPUT TYPE="radio" NAME="SearchType" VALUE="4" onClick="setInfo()"> By Region <BR/> </FONT>
  64.     </TD>
  65. </TR>
  66.  
  67. <TR> 
  68.     <TH VALIGN="top" ID="SLABEL"></TH>
  69.     <TD ID="SBOX" STYLE="visibility: hidden;"><FONT FACE="HELVETICA,HELV,ARIAL" SIZE="2">
  70.         <INPUT NAME="SearchWith" Size="40"></FONT>
  71.     </TD>
  72. </TR>
  73.  
  74. <TR>
  75.     <TH ALIGN="right" VALIGN="top"><FONT FACE="HELVETICA,HELV,ARIAL" SIZE="2">Enter Dates </FONT></TH>
  76.     <TD>
  77.          <FONT FACE="HELVETICA,HELV,ARIAL" SIZE="2">&nbsp;From </FONT>
  78.          <INPUT ID="FDates" NAME="FDates" Size="9">
  79.        
  80.          <FONT FACE="HELVETICA,HELV,ARIAL" SIZE="2">&nbsp;To </FONT>
  81.          <INPUT ID="TDates" NAME="TDates" Size="9">
  82.     </TD>
  83. </TR>
  84.  
  85. <TR>
  86.     <TD></TD>
  87.     <TD><INPUT CLASS="Table_Blue" TYPE="submit" NAME="Submit" VALUE="SEARCH YOUR REPORT"></TD>
  88. </TR>
  89. </TABLE>
  90. </FORM>
  91.  
  92. <CENTER>
  93. <FONT FACE="HELVETICA,HELV,ARIAL" COLOR="#FF0000" SIZE="2">
  94.                 <%
  95.                 If Request.QueryString("error") <> "" Then
  96.                 Response.Write(Request.QueryString("error"))
  97.                 End If
  98.                 %>
  99. </FONT>
  100. </CENTER>
  101.  
  102. </BODY>
  103. </HTML>


Code: ( text )
  1. <%
  2. strSearchType = trim(Request("SearchType"))
  3. strFDates = trim(Request("FDates"))
  4. strTDates = trim(Request("TDates"))
  5. If Not IsNumeric(strSearchType) Then sType = 0 Else sType = CDBL(strSearchType)
  6.  
  7. strSearchWith = trim(Request("SearchWith"))
  8. sqlSearchWith = "'%" & Replace(strSearchWith,"'","''") & "%'"
  9.  
  10. FDate = "NO"
  11. TDate = "NO"
  12. On Error Resume Next
  13.     FDate = DateValue( CDate( Request("FDates") ) )
  14.     TDate = DateValue( CDate( Request("TDates") ) )
  15. On Error GoTo 0
  16.  
  17. If strFDates = "" OR _
  18.    strTDates = "" Then
  19. Response.Redirect("SearchReports-Test.asp?error=Please+enter+all+the+required+field  s+before+searching. Thanks.")
  20.  
  21. Else
  22. Set Conn = Server.CreateObject("ADODB.Connection")
  23. Set RS = Server.CreateObject("ADODB.RecordSet")
  24.  
  25. Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("Database.mdb") _
  26.         & "; Jet OLEDB:Database Password=happy"
  27.  
  28. select case sType
  29.     case 0 : where = " WHERE 1=1 "
  30.     case 1 : where = " WHERE Individual LIKE " & sqlSearchWith
  31.     case 2 : where = " WHERE ProjectType LIKE " & sqlSearchWith
  32.     case 3 : where = " WHERE Network LIKE " & sqlSearchWith
  33.     case 4 : where = " WHERE Region LIKE " & sqlSearchWith
  34.     case else
  35.         Response.Redirect ("SearchReports-Test.asp?error=Sorry+...+Please+enter+a+valid+sear  ch+type.")   
  36. end select
  37.  
  38. strSQL = "SELECT * FROM TableProjects " & where
  39.  
  40. If FDate <> "NO" AND TDate <> "NO" Then
  41.     strSQL = strSQL & " AND CompleteDate BETWEEN #" & FDate & "# AND #" & TDate & "#"
  42. End If
  43.  
  44. strSQL = strSQL & " ORDER BY Individual, RecordID"
  45.  
  46. RS.Open strSQL, Conn
  47.  
  48. If (RS.EOF) Then
  49.     Response.Redirect ("SearchReports-Test.asp?error=Sorry+...+Report+does+not+exist.  +Please+enter+a+valid+search+type.+  Thanks.")
  50. End If
  51. End If
  52. %>
  53.  
  54. <HTML>
  55. <HEAD>
  56. <TITLE>Homepage</TITLE>
  57.  
  58.  
  59. </HEAD>
  60.  
  61. <BODY ONLOAD="jsClock()" BGCOLOR="#FFFFFF">
  62.  
  63. <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
  64.  
  65. <DIV ALIGN="LEFT">
  66.  
  67. <TABLE WIDTH="100%"BORDER="1" CELLSPACING="0" CELLPADDING="1">
  68.   <TR BGCOLOR="CEEFFF">
  69.     <TD WIDTH="5%"  CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>RECORD ID</STRONG></DIV></FONT></TD>
  70.     <TD WIDTH="15%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>INDIVIDUAL</STRONG></DIV></FONT></TD>
  71.     <TD WIDTH="8%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>COMPLETE DATE</STRONG></DIV></FONT></TD>
  72.     <TD WIDTH="15%"  CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>NETWORK</STRONG></DIV></FONT></TD>
  73.     <TD WIDTH="25%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>PROJECT TYPE</STRONG></DIV></FONT></TD>
  74.     <TD WIDTH="25%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>REGION</STRONG></DIV></FONT></TD>
  75.   </TR>
  76.  
  77. <CENTER>
  78. <%
  79.  
  80. WHILE NOT RS.EOF
  81.    
  82. Response.Write("<TR>")
  83. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("RecordID") & "&nbsp;</FONT></TD>")
  84. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Individual") & "&nbsp;</FONT></TD>")
  85. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("CompleteDate") & "&nbsp;</FONT></TD>")
  86. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Network") & "&nbsp;</FONT></TD>")
  87. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("ProjectType") & "&nbsp;</FONT></TD>")
  88. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Region") & "&nbsp;</FONT></TD>")
  89.  
  90. Response.Write("</TR>")
  91.  
  92. strCount=strCount + 1
  93.  
  94. RS.MoveNext
  95. Wend
  96.  
  97. RS.Close
  98. Conn.Close
  99. set Conn = nothing
  100. set RS = Nothing
  101. %>
  102. </CENTER>
  103. </TABLE>
  104. <BR>
  105. <%   
  106.                       Response.Write("<FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">Total Records:   ")
  107.                       Response.Write("</FONT>")
  108.                         Response.Write("<FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#FF0000"" SIZE=""2"">")
  109.                         Response.Write(strCount)
  110.                         Response.Write("</FONT>")
  111. %>
  112. </DIV>
  113.  
  114. </BODY>
  115. </HTML>

Reply
idsanjeev's Avatar
idsanjeev
Familiar Sight
214 Posts
March 12th, 2008
04:59 AM
#10

Re: Total Record Count per Individual
Hi hotflash
i think you have to change your code for count individually.
But Dr. B can help you out if is possible to count individually with your code.
i havn't any idea but i try to think if is possible.
regards
jha

Reply
hotflash's Avatar
hotflash
Member
85 Posts
March 13th, 2008
12:06 AM
#11

Re: Total Record Count per Individual
Thanks for your outstanding support and let me know if you have any luck or not.

Meanwhile, Dr B and CroCrew, any comments? Thanks.

Reply
DrBunchman's Avatar
DrBunchman
Moderator
555 Posts
March 17th, 2008
03:59 PM
#12

Re: Total Record Count per Individual
Hi Hotflash,

Sorry for the late reply - I've been on holiday - hopefully you've got it working by now but if not....

Do you mean you want to use a different column in your count depending on which search type the user selects?

This shouldn't cause you any problems once you get started. Just remember that any columns that you Select alongside your Count need to be included in your Group By clause. For example, in the statement below I've selected Col1 and Col2 so I've had to include them in my Group By:

SELECT Col1, Col2, COUNT(Col3) FROM Table1 WHERE Col1 = 'A' GROUP BY Col1, Col2

Keep it simple - build a complete sql statement for each value of sType in your case statement. You can start to make it more efficient once you've got it working.

Looking at your code I can't see you attempting to implement this anywhere - give it a try yourself then come back to us if you have any problems.

Let us know how you get on,

Dr B

Reply
hotflash's Avatar
hotflash
Member
85 Posts
March 18th, 2008
10:15 PM
#13

Re: Total Record Count per Individual
Hi Dr B (The Expert),

Thanks for your replying and hope you had a good holiday. I have been extremely busy on my daily projects as well. This is something very new to me and just want to do it for experience. Hope you can help me know. I know you can because you are the EXPERT on this stuff. Just want to make sure we are on the same sheet of music here.

Let's say there are 3 people in the team: myself (hotflash), dr b and jha. Each of us here completed 2 projects such as "server install" (this is a type of project or Project Type as listed in the case statement). The current working code, if you select By Project Type, type in "Server Install" in the search box and put in the From and To Dates, it will display the following and it is sorted by Individual.

Individual Project Type
Hotflash Server Install
Hotflash Server Install
Dr B Server Install
Dr B Server Install
Jha Server Install
Jha Server Install

Total Records: 6

Again, the code that I provided you WORK as listed above!

What I want but not knowing what to do is:

Individual Project Type
Hotflash Server Install
Hotflash Server Install

Total Records: 2

Dr B Server Install
Dr B Server Install

Total Records: 2

Jha Server Install
Jha Server Install

Total Records: 2

Grand Total: 6

I have sent Jha the codes for him to look over as well. I think it will be easy for me to send you the codes so you can see the output. I can't seem to integrate what you provided that's why I replied to this forum again to make sure I am not confusing you. As always, you are the best of all best and thanks for your outstanding support.

Reply
DrBunchman's Avatar
DrBunchman
Moderator
555 Posts
March 25th, 2008
01:38 PM
#14

Re: Total Record Count per Individual
Hi hotflash, have you got this sorted out yet? If not let me know and I'll take a look at it for you.

Dr B

Reply
hotflash's Avatar
hotflash
Member
85 Posts
March 26th, 2008
12:51 AM
#15

Re: Total Record Count per Individual
Hi Dr. B,

Haven't tried again lately. Honestly, I am new to the ASP world and this portion is way over my head and would appreciate if you can take a look for me. Please let me know if you can help. Thanks once again for your outstanding support.

Reply
deric's Avatar
deric
Member
70 Posts
March 26th, 2008
03:21 AM
#16

Re: Total Record Count per Individual
Code: ( text )
  1. <%
  2. strSearchType = trim(Request("SearchType"))
  3. strFDates = trim(Request("FDates"))
  4. strTDates = trim(Request("TDates"))
  5. If Not IsNumeric(strSearchType) Then sType = 0 Else sType = CDBL(strSearchType)
  6.  
  7. strSearchWith = trim(Request("SearchWith"))
  8. sqlSearchWith = "'%" & Replace(strSearchWith,"'","''") & "%'"
  9.  
  10. FDate = "NO"
  11. TDate = "NO"
  12. On Error Resume Next
  13.     FDate = DateValue( CDate( Request("FDates") ) )
  14.     TDate = DateValue( CDate( Request("TDates") ) )
  15. On Error GoTo 0
  16.  
  17. If strFDates = "" OR _
  18.    strTDates = "" Then
  19. Response.Redirect("SearchReports-Test.asp?error=Please+enter+all+the+required+field  s+before+searching. Thanks.")
  20.  
  21. Else
  22. Set Conn = Server.CreateObject("ADODB.Connection")
  23. Set RS = Server.CreateObject("ADODB.RecordSet")
  24.  
  25. Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("Database.mdb") _
  26.         & "; Jet OLEDB:Database Password=happy"
  27.  
  28. select case sType
  29.     case 0 : where = " WHERE 1=1 "
  30.     case 1 : where = " WHERE Individual LIKE " & sqlSearchWith
  31.     case 2 : where = " WHERE ProjectType LIKE " & sqlSearchWith
  32.     case 3 : where = " WHERE Network LIKE " & sqlSearchWith
  33.     case 4 : where = " WHERE Region LIKE " & sqlSearchWith
  34.     case else
  35.         Response.Redirect ("SearchReports-Test.asp?error=Sorry+...+Please+enter+a+valid+sear  ch+type.")   
  36. end select
  37.  
  38. strSQL = "SELECT * FROM TableProjects " & where
  39.  
  40. If FDate <> "NO" AND TDate <> "NO" Then
  41.     strSQL = strSQL & " AND CompleteDate BETWEEN #" & FDate & "# AND #" & TDate & "#"
  42. End If
  43.  
  44. strSQL = strSQL & " ORDER BY Individual, RecordID"
  45.  
  46. RS.Open strSQL, Conn
  47.  
  48. If (RS.EOF) Then
  49.     Response.Redirect ("SearchReports-Test.asp?error=Sorry+...+Report+does+not+exist.  +Please+enter+a+valid+search+type.+  Thanks.")
  50. End If
  51. End If
  52. %>
  53.  
  54. <HTML>
  55. <HEAD>
  56. <TITLE>Homepage</TITLE>
  57.  
  58.  
  59. </HEAD>
  60.  
  61. <BODY ONLOAD="jsClock()" BGCOLOR="#FFFFFF">
  62.  
  63. <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
  64.  
  65. <DIV ALIGN="LEFT">
  66.  
  67. <TABLE WIDTH="100%"BORDER="1" CELLSPACING="0" CELLPADDING="1">
  68.   <TR BGCOLOR="CEEFFF">
  69.     <TD WIDTH="5%"  CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>RECORD ID</STRONG></DIV></FONT></TD>
  70.     <TD WIDTH="15%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>INDIVIDUAL</STRONG></DIV></FONT></TD>
  71.     <TD WIDTH="8%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>COMPLETE DATE</STRONG></DIV></FONT></TD>
  72.     <TD WIDTH="15%"  CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>NETWORK</STRONG></DIV></FONT></TD>
  73.     <TD WIDTH="25%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>PROJECT TYPE</STRONG></DIV></FONT></TD>
  74.     <TD WIDTH="25%" CLASS="Table_Black"> <DIV ALIGN="CENTER"><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""1""><STRONG>REGION</STRONG></DIV></FONT></TD>
  75.   </TR>
  76.  
  77. <CENTER>
  78. <%
  79. Dim count As Int
  80. Dim curr, prev As String
  81.  
  82. strCount = 0
  83. prev = ""
  84.  
  85. WHILE NOT RS.EOF
  86.  
  87. curr = RS("Individual")
  88. If curr = prev Then
  89.   count = count + 1
  90. Else
  91.   count = 1
  92. End If
  93.  
  94. Response.Write("<TR>")
  95. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("RecordID") & "&nbsp;</FONT></TD>")
  96. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Individual") & "&nbsp;</FONT></TD>")
  97. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("CompleteDate") & "&nbsp;</FONT></TD>")
  98. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Network") & "&nbsp;</FONT></TD>")
  99. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("ProjectType") & "&nbsp;</FONT></TD>")
  100. Response.Write("<TD><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & RS("Region") & "&nbsp;</FONT></TD>")
  101.  
  102. Response.Write("</TR>")
  103.  
  104. strCount=strCount + 1
  105.  
  106. If prev <> "" And curr <> prev Then
  107. Response.Write("<TR>")
  108. Response.Write("<TD COLSPAN=6><FONT FACE=""HELVETICA,HELV,ARIAL"" COLOR=""#000000"" SIZE=""2"">" & count & "&nbsp;</FONT></TD>")
  109. Response.Write("</TR>")
  110. End If
  111. prev = curr
  112.  
  113. RS.MoveNext
  114. Wend
  115.  
  116. RS.Close
  117. Conn.Close
  118. set Conn = nothing
  119. set RS = Nothing
  120. %>
  121. </CENTER>
  122. </TABLE>
  123. <BR>
  124. <%