Advertisement

04.22.2008 at 08:40AM PDT, ID: 23343369
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Microsoft VBScript runtime error '800a0005' - DateAdd
Tags: Microsoft VBScript runtime error '800a0005' - Invalid procedure call or argument: 'DateAdd'
I got this error when running my program.  The strange thing about this error is there isn't a DateAdd piece of code in the code.  The other strange thing is when I tested the program for all our different branches it only did this on a couple of them, not all of them.

I'm a novice programmer and this is someone's code that I'm looking at so that doesn't help.  I have attached the code.  If you need something else, please feel free to ask.
Thank you,
Kell
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/JXECM.asp" -->
<%
' note: if either date entered by the user is invalid, 
'     the call to CDate will fail with an error.
firstDate = CDate( Request.Form("start") )
lastDate = CDate( Request.Form("end") )
callbranch = Request.Form("branch")
calltype = Request.Form("Code")
 
Dim rsCalls
Dim rsCalls_numRows
 
Set rsCalls = Server.CreateObject("ADODB.Recordset")
rsCalls.ActiveConnection = MM_JXECM_STRING
rsCalls.Source = "SELECT Calls.YourName, Calls.Notes, Calls.CallDate, Code.CSICode, Code.Description, tblCSI.Response, tblCSI.Tocsi, tblCSI.RespondDate, tblCSI.Respondent, tblCSI.CSICODE, tblCSI.Issue, tblCSI.IssueDate, tblCSI.CustomerID, tblCSI.IssueKind, Employee.EmployeeName, Employee.Branch, CustName.CustName, CustName.CompPhone  FROM Employee INNER JOIN (Code INNER JOIN (CustName INNER JOIN tblCSI ON CustName.ContactID = tblCSI.CustomerID) ON Code.CSICode = tblCSI.CSICODE) ON Employee.EmployeeName = CustName.SlsmnName WHERE '" & callbranch & "' = Employee.Branch AND  '" & calltype & "' = Code.CSICode AND Calls.CallDate BETWEEN #" & firstDate & "# AND #" & lastDate & "# ORDER BY Calls.CallDate DESC"
rsCalls.CursorType = 0
rsCalls.CursorLocation = 2
rsCalls.LockType = 1
rsCalls.Open()
 
rsCalls_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
 
Repeat1__numRows = -1
Repeat1__index = 0
rsCalls_numRows = rsCalls_numRows + Repeat1__numRows
 
'Dim ResponseTime = RespondDate - IssueDate
%>
<html>
<head>
<title>CSI Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<body>
<!--#include file="header.inc"-->
<br>
<table width="1027" border="1" align="center" cellspacing="0">
  <tr bgcolor="#0099FF"> 
    <td colspan="13"> <div align="Center"><strong>CSI Report</strong></div></td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td width="20" nowrap><font size="-1"><strong>Branch</strong></font></td>
    <td width="30" nowwrap><font size="-1"><strong>Customer</strong></font></td>
    <td width="20" nowrap><font size="-1"><strong>Phone</strong></font></td>
    <td width="20" nowrap><font size="-1"><strong>Code #</strong></font></td>
    <td width="25" nowrap><font size="-1"><strong>To</strong></font></td>
    <td width="20" nowrap><font size="-1"><strong>Issue Type</strong></font></td>
	<td width="20" nowrap><font size="-1"><strong>Issue Date</strong></font></td>
	<td width="87" nowrap><font size="-1"><strong>Issue</strong></font></td>
	<td width="20" nowrap><font size="-1"><strong>Respondent</strong></font></td>
	<td width="20" nowrap><font size="-1"><strong>Response Date</strong></font></td>
	<td width="87" nowrap><font size="-1"><strong>Response</strong></font></td>
	</tr>
  <% 
While ((Repeat1__numRows <> 0) AND (NOT rsCalls.EOF)) 
%>
  <% If Not rsCalls.EOF Or Not rsCalls.BOF Then %>
  <tr> 
    <td nowrap width="20"><font size="-1"><%=(rsCalls.Fields.Item("Branch").Value)%></font></td>
    <td nowrap width="30"><font size="-1"><%=(rsCalls.Fields.Item("CustName").Value)%></font></td>
    <td nowrap width="20"><%=(rsCalls.Fields.Item("CompPhone").Value)%><br> 
    <td nowrap width="20"><%=(rsCalls.Fields.Item("CSICode").Value)%><br>
    <td nowrap width="25"><%=(rsCalls.Fields.Item("Tocsi").Value)%><br>
    <td nowrap width="20"><%=(rsCalls.Fields.Item("IssueKind").Value)%><br>
    <td nowrap width="20"><%=(rsCalls.Fields.Item("IssueDate").Value)%><br>
    <td nowrap width="87"><%=(rsCalls.Fields.Item("Issue").Value)%><br>
    <td nowrap width="20"><%=(rsCalls.Fields.Item("Respondent").Value)%><br>
    <td nowrap width="20"><%=(rsCalls.Fields.Item("RespondDate").Value)%><br>
    <td nowrap width="87"><font size="-1"><%=(rsCalls.Fields.Item("Response").Value)%><br>
    </font></td>
    
  </tr>
  <% End If ' end Not rsCalls.EOF Or NOT rsCalls.BOF %>
  <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsCalls.MoveNext()
Wend
%>
  <tr> 
    <% If rsCalls.EOF And rsCalls.BOF Then %>
    <td colspan="13">No 
      Info Available</td>
    <% End If ' end rsCalls.EOF And rsCalls.BOF %>
  </tr>
</table>
 
</body>
</html>
<%
rsCalls.Close()
Set rsCalls = Nothing
%>
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: mschmidt14
Solution Provided By: hongjun
Participating Experts: 2
Solution Grade: A
Views: 12
Translate:
Loading Advertisement...
04.22.2008 at 08:42AM PDT, ID: 21412239

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.22.2008 at 09:29AM PDT, ID: 21412797

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.22.2008 at 09:36AM PDT, ID: 21412869

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.22.2008 at 09:50AM PDT, ID: 21413025

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.22.2008 at 08:28PM PDT, ID: 21417572

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.23.2008 at 05:53AM PDT, ID: 21420062

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.23.2008 at 07:44AM PDT, ID: 21421223

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.23.2008 at 07:59AM PDT, ID: 21421418

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.23.2008 at 08:10AM PDT, ID: 21421519

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.23.2008 at 08:13AM PDT, ID: 21421569

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.23.2008 at 03:49PM PDT, ID: 21426273

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.29.2008 at 02:08PM PDT, ID: 21466210

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
04.29.2008 at 04:59PM PDT, ID: 21467214

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 12:49PM PDT, ID: 21510406

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 05:14PM PDT, ID: 21512148

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.06.2008 at 05:14PM PDT, ID: 21512161

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 07:37AM PDT, ID: 21516857

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 07:46AM PDT, ID: 21516985

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 07:47AM PDT, ID: 21516991

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 08:20AM PDT, ID: 21517349

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 08:32AM PDT, ID: 21517480

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 08:57AM PDT, ID: 21517738

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 09:02AM PDT, ID: 21517783

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 09:13AM PDT, ID: 21517878

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 09:17AM PDT, ID: 21517921

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 09:26AM PDT, ID: 21518013

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 09:29AM PDT, ID: 21518041

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 09:49AM PDT, ID: 21518217

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 06:13AM PDT, ID: 21524284

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.12.2008 at 08:38AM PDT, ID: 21547929

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
04.22.2008 at 08:42AM PDT, ID: 21412239

Rank: Sage

Post what is in Connections/JXECM.asp
 
04.22.2008 at 09:29AM PDT, ID: 21412797
<%
' FileName="Connection_ado_conn_string.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="true"
' Catalog=""
' Schema=""
Dim MM_JXECM_STRING
MM_JXECM_STRING = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\web2\contactmanagement\database\web Contact Management.mdb"
%>
 
04.22.2008 at 09:36AM PDT, ID: 21412869

Rank: Sage

What about header.inc ?
Make sure you scan through all codes incuding those that are included for DateAdd.

hongjun
 
04.22.2008 at 09:50AM PDT, ID: 21413025
The header is just a .jpg with our company's logo.  And as I said in the very first communication, there isn't any code that says DateAdd.  You have the whole program!  Now do you know why I'm so confused?  I thought you would know something I didn't!  Please tell me you do!!
 
04.22.2008 at 08:28PM PDT, ID: 21417572

Rank: Genius

Hi Kell, does the error you receive tell you what line the error is on?

Perhaps place some
response.write "check 1"
''''
respone.write "check 2"

kind of statements throughout the code to try to see where the error might be occurring?

Regards,

Rob.
 
04.23.2008 at 05:53AM PDT, ID: 21420062

Rank: Sage

Yes, try Rob's suggestion.

There is no need to shout when you are confused :)

hongjun
 
04.23.2008 at 07:44AM PDT, ID: 21421223
I wasn't shouting, shouting would be in all caps...I was just over-extended and not feeling well.  That's the problem with writing...you don't get the jist of a person's emotions.  And to top it off, I just now realized I had the wrong code.  That's the other thing with this person's work...Too many .asp files too closely named!  Here is the real code.  I'm sorry for the confusion and the accidental screaming.  :-)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


<!--#include file="Connections/JXECM.asp" -->

<%

Function amtWorkDays(end_date, start_date)

          amtWorkDays = 0
            myworkstartdate = start_date
            myworkenddate = end_date
            myworkstartdate = CDate(myworkstartdate)
            myworkenddate = CDate(myworkenddate)
            mytempworkday = myworkstartdate

            do until mytempworkday = myworkenddate
            
                  mydaycase = Weekday(mytempworkday)
                  select case mydaycase
            
                  case 1,7      
                         mytempworkday = DateAdd("D", 1, mytempworkday)
                  case else
                        mytempworkday = DateAdd("D", 1, mytempworkday)       
                        amtWorkDays = amtWorkDays + 1
                  end select
            loop
End Function



%>


<%
' note: if either date entered by the user is invalid,
'     the call to CDate will fail with an error.
firstDate   = Request.Form("startdate")
if firstDate <>  "" then firstDate   = CDate( Request.Form("startdate") )
lastDate    = Request.Form("enddate")
if lastDate <> "" then lastDate    = CDate( Request.Form("enddate") )
callbranch  = Request.Form("branch")
calltype    = Request.Form("CallType")   ' need to change the code for this criteria
issuetype   = Request.form("issuetype") ' need to add code for this criteria
issuestatus = Request.Form("issuestatus")  ' need to add code for this criteria
respond     = Request.Form("Respond")        ' need to add code for this criteria

Dim rsCalls
Dim rsCalls_numRows
Dim sQuery

Set rsCalls = Server.CreateObject("ADODB.Recordset")
rsCalls.ActiveConnection = MM_JXECM_STRING

sQuery = "SELECT  tblCSI.CallType, tblCSI.Response, tblCSI.IssueStatus  , tblCSI.CallType ,  tblCSI.Tocsi, tblCSI.RespondDate, tblCSI.Respondent, tblCSI.CSICODE, tblCSI.Issue, tblCSI.IssueDate, tblCSI.CustomerID, tblCSI.IssueType,Employee.EmployeeName, tblCSI.Branch,  CustName.CustName, CustName.CompPhone FROM Employee RIGHT JOIN( tblCSI INNER JOIN CustName ON CustName.ContactID = tblCSI.CustomerID) ON Employee.EmployeeName = CustName.SlsmnName WHERE tblCSI.CSIID is not null " ' eliminate join to the Code Table by Albert
'sQuery = "SELECT  Code.CSICode, Code.Description, tblCSI.CallType, tblCSI.Response, tblCSI.IssueStatus  , tblCSI.CallType ,  tblCSI.Tocsi, tblCSI.RespondDate, tblCSI.Respondent, tblCSI.CSICODE, tblCSI.Issue, tblCSI.IssueDate, tblCSI.CustomerID, tblCSI.IssueType,Employee.EmployeeName, Employee.Branch,  CustName.CustName, CustName.CompPhone FROM Employee RIGHT JOIN(Code INNER JOIN ( tblCSI INNER JOIN CustName ON CustName.ContactID = tblCSI.CustomerID)ON Code.CSICode = tblCSI.CSICODE) ON Employee.EmployeeName = CustName.SlsmnName WHERE tblCSI.CSIID is not null " ' Added before the above query By Albert
'sQuery = "SELECT Calls.YourName, Calls.Notes, Calls.CallDate, Code.CSICode, Code.Description, tblCSI.CallType, tblCSI.Response, tblCSI.IssueStatus  , tblCSI.CallType ,  tblCSI.Tocsi, tblCSI.RespondDate, tblCSI.Respondent, tblCSI.CSICODE, tblCSI.Issue, tblCSI.IssueDate, tblCSI.CustomerID, tblCSI.IssueType, Employee.EmployeeName, Employee.Branch, CustName.CustName, CustName.CompPhone FROM  Code INNER JOIN ((Employee INNER JOIN (CustName INNER JOIN Calls ON CustName.ContactID = Calls.ContactID)  ON (Employee.EmployeeName = CustName.SlsmnName) AND (Employee.EmployeeName = Calls.YourName)) INNER JOIN tblCSI ON CustName.ContactID = tblCSI.CustomerID) ON Code.CSICode = tblCSI.CSICODE  WHERE tblCSI.CSIID is not null " commented by Albert
'sQuery = "SELECT Calls.YourName, Calls.Notes, Calls.CallDate, Code.CSICode, Code.Description, tblCSI.CallType, tblCSI.Response, tblCSI.Tocsi, tblCSI.RespondDate, tblCSI.Respondent, tblCSI.CSICODE, tblCSI.Issue, tblCSI.IssueDate, tblCSI.CustomerID, tblCSI.IssueType, Employee.EmployeeName, Employee.Branch, CustName.CustName, CustName.CompPhone FROM  Code INNER JOIN ((Employee INNER JOIN (CustName INNER JOIN Calls ON CustName.ContactID = Calls.ContactID)  ON (Employee.EmployeeName = CustName.SlsmnName) AND (Employee.EmployeeName = Calls.YourName)) INNER JOIN tblCSI ON CustName.ContactID = tblCSI.CustomerID) ON Code.CSICode = tblCSI.CSICODE  WHERE"

'==================== Kriteria query ===========================

'
if callbranch <> "" and callbranch <> "-1" then
 sQuery = sQuery & " AND tblCSI.Branch = '"& callbranch  &"' "
end if

if respond <> "" and respond <> "-1" then
 sQuery = sQuery & " AND tblCSI.Tocsi = '"& respond  &"' "
end if

if issuetype <> "" and issuetype <> "-1" then
 sQuery = sQuery & " AND tblCSI.IssueType = '"& issuetype  &"' "
end if

if issuestatus <> "" and issuestatus <> "-1" then
 sQuery = sQuery & " AND tblCSI.IssueStatus = '"& issuestatus  &"' "
end if

if calltype <> "" and calltype <> "-1" then
 sQuery = sQuery & " AND tblCSI.CallType = '"& calltype  &"' "
end if

if firstDate <> "" and lastDate = "" then
 'sQuery = sQuery & " AND Calls.CallDate = '"& firstDate  &"' " commented by Albert
 sQuery = sQuery & " AND tblCSI.IssueDate = '"& firstDate  &"' " ' added by Albert
end if

if firstDate = "" and lastDate <> "" then
 'sQuery = sQuery & " AND Calls.CallDate = '"& lastDate  &"' " commented by Albert
  sQuery = sQuery & " AND tblCSI.IssueDate = '"& lastDate &"' " ' added by Albert
end if

if firstDate <> "" and lastDate <> "" then
 'sQuery = sQuery & " AND Calls.CallDate BETWEEN #" & firstDate & "# AND #" & lastDate & "# " commented by Albert
  sQuery = sQuery & " AND tblCSI.IssueDate BETWEEN #" & firstDate & "# AND #" & lastDate & "# "
end if


'========================= end kriteria query ============================
 sQuery = sQuery & " ORDER BY tblCSI.IssueDate DESC"



rsCalls.Source = sQuery

'Kelly- I added the next three lines of code. I'll show the results to you. JZ

dim query
Query = rsCalls.Source
'Response.Write Query
'Response.End
'**********************

rsCalls.CursorType = 0
rsCalls.CursorLocation = 2
rsCalls.LockType = 1
rsCalls.Open()

rsCalls_numRows = 0
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsCalls_numRows = rsCalls_numRows + Repeat1__numRows

'Dim ResponseTime = RespondDate - IssueDate
%>
<html>
<head>
<title>CSI Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<!--#include file="header.inc"-->
<br>
<%
 if Request.Form("cbWeb") = "Web" then
  GenHTML()
 end if
 if Request.Form("cbExcel") = "Excel" then
  CreateXlsFile()
 end if
 
%>
<% Function GenHTML() %>
<table width="1700" border="1" align="center" cellspacing="0">
  <tr bgcolor="#0099FF">
    <td colspan="13"> <div align="Center"><strong>CSI Report</strong></div></td>
  </tr>
  <tr bgcolor="#CCCCCC">
    <td width="42" nowrap><font size="-1"><strong>Branch</strong></font></td>
    <td width="54" nowrap><font size="-1"><strong>Customer</strong></font></td>
    <td width="35" nowrap><font size="-1"><strong>Phone</strong></font></td>
    <td width="52" nowrap><font size="-1"><strong>Call Type</strong></font></td>
    <td width="22" nowrap><font size="-1"><strong>To</strong></font></td>
    <td width="58" nowrap><font size="-1"><strong>Issue Type</strong></font></td>
      <td width="57" nowrap><font size="-1"><strong>Issue Date</strong></font></td>
      <td width="506" nowrap><font size="-1"><strong>Issue</strong></font></td>
      <td width="63" nowrap><font size="-1"><strong>Code #</strong></font></td>
      <td width="111" nowrap><font size="-1"><strong>Respondent</strong></font></td>
      <td width="80" nowrap><font size="-1"><strong>Response Date</strong></font></td>
      <td width="80" nowrap><font size="-1"><strong>Response Time</strong></font></td>
      <td width="570" nowrap><font size="-1"><strong>Response</strong></font></td>
      </tr>
  <%
  If Not rsCalls.EOF Or Not rsCalls.BOF Then
While ((Repeat1__numRows <> 0) AND (NOT rsCalls.EOF))
%>
  <%
  responsetime = 0
   if rsCalls.Fields.Item("RespondDate").Value <> ""   and  rsCalls.Fields.Item("IssueDate").Value <> "" then
              responsetime =  amtWorkDays( rsCalls.Fields.Item("RespondDate").Value ,rsCalls.Fields.Item("IssueDate").Value )
       end if
  %>
  <tr>
    <td nowrap width="42"><font size="-1"><%=(rsCalls.Fields.Item("Branch").Value)%>&nbsp;</font></td>
    <td nowrap width="54"><font size="-1"><%=(rsCalls.Fields.Item("CustName").Value)%>&nbsp;</font></td>
    <td nowrap width="35"><font size="-1"><%=(rsCalls.Fields.Item("CompPhone").Value)%>&nbsp;</font></td>
    <td nowrap width="52"><font size="-1"><%=(rsCalls.Fields.Item("CallType").Value)%>&nbsp;</font></td>
    <td nowrap width="22"><font size="-1"><%=(rsCalls.Fields.Item("Tocsi").Value)%>&nbsp;</font></td>
    <td nowrap width="58"><font size="-1"><%=(rsCalls.Fields.Item("IssueType").Value)%>&nbsp;</font></td>
    <td nowrap width="57"><font size="-1"><%=(rsCalls.Fields.Item("IssueDate").Value)%>&nbsp;</font></td>
    <td nowrap width="506"><font size="-1"><%=(rsCalls.Fields.Item("Issue").Value)%>&nbsp;</font></td>
    <td nowrap width="63"><font size="-1"><%=(rsCalls.Fields.Item("CSICODE").Value)%>&nbsp;</font></td>
    <td nowrap width="111"><font size="-1"><%=(rsCalls.Fields.Item("Respondent").Value)%>&nbsp;</font></td>
    <td nowrap width="80"><font size="-1"><%=(rsCalls.Fields.Item("RespondDate").Value)%>&nbsp;</font></td>
    <td nowrap width="80"><font size="-1"><%=responsetime%>&nbsp;</font></td>
    <td nowrap width="570"><font size="-1"><%=(rsCalls.Fields.Item("Response").Value)%>&nbsp;</font></td>
     
  </tr>
  <% %>
  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsCalls.MoveNext()
Wend
End If ' end Not rsCalls.EOF Or NOT rsCalls.BOF
%>
  <tr>
    <% If rsCalls.EOF And rsCalls.BOF Then %>
    <td colspan="13" width="720">No
      Info Available</td>
    <% End If ' end rsCalls.EOF And rsCalls.BOF %>
  </tr>
</table>
<% end function


Function CreateXlsFile()

Set rsExcel = Server.CreateObject("ADODB.Recordset")
rsExcel.ActiveConnection = MM_JXECM_STRING

rsExcel.CursorType = 0
rsExcel.CursorLocation = 2
rsExcel.LockType = 1

rsExcel.Source = sQuery
rsExcel.Open()

      Dim xlWorkSheet
      Dim xlApplication
      Set xlApplication=CreateObject("Excel.Application")
      xlApplication.Visible=False
      xlApplication.Workbooks.Add
      Set xlWorksheet=xlApplication.Worksheets(1)
      t=0
      
t=t+1
            xlWorksheet.Cells(1,t).Value="Branch"
            xlWorksheet.Cells(1,t).Interior.ColorIndex=6
t=t+1
            xlWorksheet.Cells(1,t).Value="Customer"
            xlWorksheet.Cells(1,t).Interior.ColorIndex=6
t=t+1
            xlWo