Link to home
Start Free TrialLog in
Avatar of Andrew
AndrewFlag for United States of America

asked on

Cannot convert a char value to money. The char value has incorrect syntax??

Having a problem with a reporting tool. The thing has worked for months until a negative daily sales(DSTotSales) amount got thrown into the mix today. I cant seem to pinpoint the conversion that is causing the problem....

ERROR:
Cannot convert a char value to money. The char value has incorrect syntax??

CODE:

NightlyStoreNumbers2.asp
<%
            Dim RepDate,StoreName,Goal,EFT,DSTotSales,DSSessions,DDTotSales,DDDraftDep,DDSalesTax,DDPaymentAcct,DDInHouse,DDGiftCerts,DDReturnEFT,DDProdSales,DDBonusBucks
            Dim DDPrepaidDlrs,DDMysticMem,DDBuyMem,DDMysticSales,DDMysticSess,DDNewClients,DDTotSess,SBCFreeze,SBCCanRegular,SBCCanFreeze,SBCCanMystTran,SBCCanEft
            Dim      SBCCanTransfer,DaysMonth,DaysRemain
            Dim PPA,TotWEft,TotWOEft,StorePPA,StoreLPPA,PerDayHitGoal,GoalPace,NumOfMem,ClosePercent,IncrDraft
            Dim calPPA,calTotWEft,calTotWOEft,calStorePPA,calStoreLPPA,calPerDayHitGoal,calGoalPace,calNumOfMem,calClosePercent
            Dim DayofMonth, calcEFT2

            RepDate = Request.Form("RepDate")
            StoreName = Request.Form("StoreName")
            
            Goal = Request.Form("Goal")
            Goal = Ccur(Goal)
            
            EFT = Request.Form("EFT")
            EFT = Ccur(EFT)
            
            DSTotSales = Request.Form("DSTotSales")
            DSTotSales = Ccur(DSTotSales)
            
            DSSessions = Request.Form("DSSessions")
            DSSessions = CInt(DSSessions)
            
            DDTotSales = Request.Form("DDTotSales")
            DDTotSales = Ccur(DDTotSales)
            
            DDDraftDep = Request.Form("DDDraftDep")
            DDDraftDep = Ccur(DDDraftDep)
            
            DDSalesTax = Request.Form("DDSalesTax")
            DDSalesTax = Ccur(DDSalesTax)
            
            DDPaymentAcct = Request.Form("DDPaymentAcct")
            DDPaymentAcct = Ccur(DDPaymentAcct)
            
            DDInHouse = Request.Form("DDInHouse")            
            DDInHouse = Ccur(DDInHouse)
            
            DDGiftCerts = Request.Form("DDGiftCerts")            
            DDGiftCerts = Ccur(DDGiftCerts)
            
            DDReturnEFT = Request.Form("DDReturnEFT")            
            DDReturnEFT = Ccur(DDReturnEFT)
            
            DDProdSales = Request.Form("DDProdSales")
            DDProdSales = Ccur(DDProdSales)
            
            DDBonusBucks = Request.Form("DDBonusBucks")
            DDBonusBucks = Ccur(DDBonusBucks)
            
            DDPrepaidDlrs = Request.Form("DDPrepaidDlrs")
            DDPrepaidDlrs = Ccur(DDPrepaidDlrs)
            
            DDMysticMem = Request.Form("DDMysticMem")
            DDMysticMem = CInt(DDMysticMem)
                        
            DDBuyMem = Request.Form("DDBuyMem")            
            DDBuyMem = CInt(DDBuyMem)
            
            DDMysticSales = Request.Form("DDMysticSales")            
            DDMysticSales = Ccur(DDMysticSales)
            
            DDMysticSess = Request.Form("DDMysticSess")            
            DDMysticSess = CInt(DDMysticSess)
            
            DDNewClients = Request.Form("DDNewClients")            
            DDNewClients = CInt(DDNewClients)
            
            DDTotSess = Request.Form("DDTotSess")            
            DDTotSess = CInt(DDTotSess)
            
            SBCFreeze = Request.Form("SBCFreeze")            
            SBCFreeze = CInt(SBCFreeze)
            
            SBCCanRegular = Request.Form("SBCCanRegular")            
            SBCCanRegular = CInt(SBCCanRegular)            
            
            SBCCanFreeze = Request.Form("SBCCanFreeze")            
            SBCCanFreeze = CInt(SBCCanFreeze)
            
            SBCCanMystTran = Request.Form("SBCCanMystTran")            
            SBCCanMystTran = CInt(SBCCanMystTran)
            
            SBCCanEft = Request.Form("SBCCanEft")                        
            SBCCanEft = CInt(SBCCanEft)
            
            SBCCanTransfer = Request.Form("SBCCanTransfer")
            SBCCanTransfer = CInt(SBCCanTransfer)
            
            DaysMonth = Request.Form("DaysMonth")
            DaysMonth = CInt(DaysMonth)
            
            DaysRemain = Request.Form("DaysRemain")
            DaysRemain = CInt(DaysRemain)

            DayofMonth = Datepart("d",RepDate)
            DayofMonth = CInt(DayofMonth)
            
            calPPA = DSTotSales/DSSessions
            PPA = CSng(calPPA)
            
            calcTotWOEft = DDTotSales - DDDraftDep - DDInHouse - DDGiftCerts - DDReturnEFT - DDBonusBucks - DDPrepaidDlrs
            TotWOEft = Ccur(calcTotWOEft)
                        
            calcTotWEft = Ccur(EFT + DDReturnEFT + TotWOEft)
            TotWEft = Ccur(calcTotWEft)
                                                
            calcPerDayHitGoal = (Goal - TotWEft) / DaysRemain
            PerDayHitGoal = Ccur(calcPerDayHitGoal)
            
            calcStorePPA = (TotWOEft/DDTotSess)
            StorePPA = CSng(calcStorePPA)
            
            calcStoreLPPA = DDProdSales/DDTotSess
            StoreLPPA = CSng(calcStoreLPPA)            
            
            calcEFT2 = (EFT + DDReturnEFT)
            EFT2 = Ccur(calcEFT2)
            
            calcGoalPace = (((TotWOEft/DayOfMonth * DaysMonth) + EFT2) / Goal)
            GoalPace = CSng(calcGoalPace)
                        
            calcNumOfMem = (DDMysticMem + DDBuyMem)
            NumofMem = CInt(calcNumofMem)
            
            If DDNewClients = 0 THEN
            ClosePercent = 0
            Else
            calcClosePercent = (NumofMem/DDNewClients)
            ClosePercent = CSng(calcClosePercent)
            End If

            

            'TotWEft = FormatCurrency(TotWEft)
            'TotWOEft = FormatCurrency(TotWOEft)
            PerDayHitGoal = FormatNumber(calcPerDayHitGoal)
            ClosePercent = FormatPercent(ClosePercent)
            GoalPace = FormatPercent(GoalPace)
            PPA = FormatNumber(PPA)
            StorePPA = FormatNumber(StorePPA)
            StoreLPPA = FormatNumber(StoreLPPA)
            'Goal = FormatCurrency(Goal)
            'EFT = FormatCurrency(EFT)
            'EFT2 = FormatCurrency(EFT2)
            'DSTotSales = FormatCurrency(DSTotSales)
            'DDTotSales = FormatCurrency(DDTotSales)
            'DDDraftDep = FormatCurrency(DDDraftDep)
            'DDSalesTax = FormatCurrency(DDSalesTax)
            'DDPaymentAcct = FormatCurrency(DDPaymentAcct)
            'DDInHouse = FormatCurrency(DDInHouse)
            'DDGiftCerts = FormatCurrency(DDGiftCerts)
            'DDReturnEft = FormatCurrency(DDReturnEft)
            'DDProdSales = FormatCurrency(DDProdSales)
            'DDBonusBucks = FormatCurrency(DDBonusBucks)
            'DDPrepaidDlrs = FormatCurrency(DDPrepaidDlrs)
            'DDMysticSales = FormatCurrency(DDMysticSales)
            'DDPrepaidDlrs = FormatCurrency(DDPrepaidDlrs)
            
%>

<html>

<head>

<title>Nightly Store Numbers</title>

<script language="JavaScript1.2">
window.onload = window.resizeTo(1024,768);
</script>

<script>
function KeyPress()
{
//alert(window.event.keyCode)
if (window.event.keyCode == 13)
window.event.keyCode =0;
}
</script>


</head>

<body background="../../MetalNew1.jpg" bgproperties="fixed" onKeyPress="KeyPress()">

<div align="center"><font size="4"><strong><font color="#C58931" face="Tahoma">
      Nightly Store Numbers</font></strong></font></div>
<div align="center"><strong><font face="Tahoma" size="4" color="#C58931"><br>
      Verification</font></strong></div>

<FORM METHOD="POST" action="" name="NightlyStoreNumbers">
     <input type="hidden" name="isSubmitted" value="yes">
  <div align="center"><b><font face="Tahoma">Date:</font></b><font size="3" face="Tahoma"><b>
      </b>
    <input name="RepDate" size="10" readonly=true  value="<% =RepDate %>" style="text-align: Center; font-family: Tahoma" tabindex="1"><b>
      </b>
    </font><font face="Tahoma"><b>&nbsp;</b><font size="3"><b>&nbsp;&nbsp; Store:
    <input type="text" name="StoreName" size="20"  value="<% =StoreName %>" tabindex="2" style="text-align: center" readonly></b></font></font></div>
      <div align="center">&nbsp;<center>
            <table border="0" width="38%" cellspacing="1">
                  <tr>
                        <td align="center" nowrap>
                        <p align="right"><b><font face="Tahoma">Goal:</font></b></td>
                        <td align="center" nowrap><font face="Tahoma" size="3">
                        <input name="Goal" size="10" readonly=true  value="<% =Goal %>" style="text-align: Right; font-family: Tahoma" tabindex="3" maxlength="12" style="float: right"></font></td>
                        <td width="49%" align="right" nowrap colspan="2">
                        <p align="center"><font face="Tahoma"><b>Department &amp; Division</b></font></td>
                  <tr>
                        <td align="center" nowrap>
                        <p align="right"><b><font face="Tahoma">EFT:</font></b></td>
                        <td align="center" nowrap><font face="Tahoma" size="3">
                        <input name="EFT" size="10" readonly=true  value="<% =EFT %>" style="text-align: Right; font-family: Tahoma" tabindex="4" maxlength="12" style="float: right"></font></td>
                        <td width="29%" align="right" nowrap><font face="Tahoma">Total
                        Sales</font><font color="#000000" face="Tahoma">:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDTotSales"  value="<% =DDTotSales %>" style="text-align: Right; font-family: Tahoma" size="10" readonly=true tabindex="15" maxlength="12" style="float: right"></font></td>
                  <tr>
                        <td align="center" nowrap colspan="2">&nbsp;</td>
                        <td width="29%" align="right" nowrap>
                        <font color="#000000" face="Tahoma">Draft Deposit:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDDraftDep" size="10" readonly=true  value="<% =DDDraftDep %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="16"></font></td>
                  <tr>
                        <td align="center" nowrap colspan="2">
                        <p align="center"><font face="Tahoma"><b>Daily Sales</b></font></td>
                        <td width="29%" align="right" nowrap><font face="Tahoma">Sales Tax</font><font color="#000000" face="Tahoma">:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDSalesTax" size="10" readonly=true  value="<% =DDSalesTax %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="17"></font></td>
                  <tr>
                        <td align="right" nowrap><font face="Tahoma">Sales</font><font color="#000000" face="Tahoma">:</font></td>
                        <td align="right" nowrap>
                        <p align="center"><font face="Tahoma" size="3">
                        <input name="DSTotSales" size="10" readonly=true tabindex="5"  value="<% =DSTotSales %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right"></font></td>
                        <td width="29%" align="right" nowrap><font face="Tahoma">Payment
                        on Account</font><font color="#000000" face="Tahoma">:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDPaymentAcct" size="10" readonly=true  value="<% =DDPaymentAcct %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="18"></font></td>
                  <tr>
                        <td width="22%" align="right" nowrap>
                        <font color="#000000" face="Tahoma">Sessions:</font></td>
                        <td>
                        <div align="center"><font face="Tahoma" size="3">
                              <input name="DSSessions" size="10" readonly=true  value="<% =DSSessions %>" style="text-align: Right; font-family: Tahoma" tabindex="6" maxlength="12" style="float: right"></font></div>
                        </tr><font face="Tahoma">
        <center>
                        </font>
                        <td width="29%" align="right" nowrap>
                        <font color="#000000" face="Tahoma">In House Charge:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDInHouse" size="10" readonly=true  value="<% =DDInHouse %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="19"></font></td>
                  <tr>
                        <td width="22%" align="right" nowrap>&nbsp;</td>
                        <td>
                        <div align="left"><font face="Tahoma" size="3">&nbsp;</font></div>
                        </tr><font face="Tahoma">
        <center>
                        </font>
                        <td width="29%" align="right" nowrap>
                        <font color="#000000" face="Tahoma">Gift Certificates:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDGiftCerts" size="10" readonly=true  value="<% =DDGiftCerts %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="20"></font></td>
                  <tr>
                        <td align="right" nowrap colspan="2">
                        <p align="center"><font face="Tahoma"><b>Sales by Code</b></font></td>
                        <td width="29%" align="right" nowrap>
                        <font color="#000000" face="Tahoma">Returned EFT:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDReturnEFT" size="10" readonly=true  value="<% =DDReturnEFT %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="21"></font></td>
                  <tr>
                        <td width="22%" align="right" nowrap><font face="Tahoma">Freeze:</font></td>
                        <td>
                        <div align="left"><font face="Tahoma" size="3"> <input type="text" name="SBCFreeze" size="10" readonly=true  value="<% =SBCFreeze %>" style="text-align: Right; font-family: Tahoma" tabindex="7" maxlength="12" style="float: right"></font></div>
                        </tr><font face="Tahoma">
        <center>
                        </font>
                        <td width="29%" align="right" nowrap><font face="Tahoma">Product Sales:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDProdSales" size="10" readonly=true  value="<% =DDProdSales %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="22"></font></td>
                  <tr>
                        <td width="22%" align="right" nowrap><font face="Tahoma">Cancel Regular:</font></td>
                        <td width="20%" align="left" nowrap>
                        <div align="left"><font face="Tahoma" size="3"><input type="text" name="SBCCanRegular" size="10" readonly=true  value="<% =SBCCanRegular %>" style="text-align: Right; font-family: Tahoma" tabindex="8" maxlength="12" style="float: right"></font></div>
                        </td>
                        <td width="29%" align="right" nowrap><font face="Tahoma">Bonus
                        Bucks:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDBonusBucks" size="10" readonly=true  value="<% =DDBonusBucks %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="23"></font></td>
                  </tr>
                  <tr>
                        <td width="22%" align="right" nowrap><font face="Tahoma">Cancel
                        Freeze:</font></td>
                        <td width="20%" align="left" nowrap>
                        <div align="left"><font face="Tahoma" size="3"><input type="text" name="SBCCanFreeze" size="10" readonly=true  value="<% =SBCCanFreeze %>" style="text-align: Right; font-family: Tahoma" tabindex="9" maxlength="12" style="float: right"></font></div>
                        </td>
                        <td width="29%" align="right" nowrap><font face="Tahoma">Prepaid
                        Dollars:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDPrepaidDlrs" size="10" readonly=true  value="<% =DDPrepaidDlrs %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="24"></font></td>
                  </tr>
                  <tr>
                        <td width="22%" align="right" nowrap><font face="Tahoma">Cancel
                        Mystic/Transfer:</font></td>
                        <td width="20%" align="left" nowrap>
                        <div align="left"><font face="Tahoma" size="3"><input type="text" name="SBCCanMystTran" size="10" readonly=true  value="<% =SBCCanMystTran %>" style="text-align: Right; font-family: Tahoma" tabindex="10" maxlength="12" style="float: right"></font></div>
                        </td>
                        <td width="29%" align="right" nowrap><font face="Tahoma">Mystic
                        Memb:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDMysticMem" size="10" readonly=true  value="<% =DDMysticMem %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="25"></font></td>
                  </tr>
                  <tr>
                        <td width="22%" align="right" nowrap><font face="Tahoma">Cancel EFT:</font></td>
                        <td width="20%" align="left" nowrap>
                        <div align="left"><font face="Tahoma" size="3"><input type="text" name="SBCCanEft" size="10" readonly=true  value="<% =SBCCanEft %>" style="text-align: Right; font-family: Tahoma" tabindex="11" maxlength="12" style="float: right"></font></div>
                        </td>
                        <td width="29%" align="right" nowrap><font face="Tahoma">Buy Memb:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDBuyMem" size="10" readonly=true  value="<% =DDBuyMem %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="26"></font></td>
                  </tr>
                  <tr>
                        <td width="22%" align="right" nowrap><font face="Tahoma">Cancel Transfer:</font></td>
                        <td width="20%" align="left" nowrap>
                        <div align="left"><font face="Tahoma" size="3"><input type="text" name="SBCCanTransfer" size="10" readonly=true  value="<% =SBCCanTransfer %>" style="text-align: Right; font-family: Tahoma" tabindex="12" maxlength="12" style="float: right"></font></div>
                        </td>
                        <td width="29%" align="right" nowrap><font face="Tahoma">Mystic
                        Sales:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDMysticSales" size="10" readonly=true  value="<% =DDMysticSales %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="27"></font></td>
                  </tr>
                  <tr>
                        <td width="22%" align="right" nowrap>&nbsp;</td>
                        <td width="20%" align="left" nowrap>
                        <div align="left"><font face="Tahoma" size="3">&nbsp;</font></div>
                        </td>
                        <td width="29%" align="right" nowrap><font face="Tahoma">Mystic
                        Sessions:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDMysticSess" size="10" readonly=true  value="<% =DDMysticSess %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="28"></font></td>
                  </tr>
                  <tr>
                        <td width="22%" align="right" nowrap><b><font face="Tahoma">Days
                        in Month:</font></b></td>
                        <td width="20%" align="left" nowrap>
                        <font face="Tahoma" size="3">
                        <input name="DaysMonth" size="10" readonly=true  value="<% =DaysMonth %>" style="text-align: Right; font-family: Tahoma" tabindex="13" maxlength="12" style="float: right"></font></td>
                        <td width="29%" align="right" nowrap><font face="Tahoma">New
                        Clients:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDNewClients" size="10" readonly=true  value="<% =DDNewClients %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="29"></font></td>
                  </tr>
                  <tr>
                        <td width="22%" align="right" nowrap><b><font face="Tahoma">Days
                        Remaining:</font></b></td>
                        <td width="20%" align="left" nowrap>
                        <font face="Tahoma" size="3">
                        <input name="DaysRemain" size="10" readonly=true  value="<% =DaysRemain %>" style="text-align: Right; font-family: Tahoma" tabindex="14" maxlength="12" style="float: right"></font></td>
                        <td width="29%" align="right" nowrap><font face="Tahoma">Total
                        Sessions:</font></td>
                        <td width="19%" align="right" nowrap>
                        <font face="Tahoma" size="3">
                        <input type="text" name="DDTotSess" size="10" readonly=true  value="<% =DDTotSess %>" style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: right" tabindex="30"></font></td>
                  </tr>
                  <tr>
                        <td width="90%" align="right" nowrap colspan="4">
                        <p align="center"><font face="Tahoma" color="#C58931"><b>
                        Calculated Fields</b></font></td>
                  </tr>
                  <tr>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma">PPA.:</font></td>
                        <td width="45%" align="left" nowrap colspan="2">
                        <font face="Tahoma" size="3">
                        <input name="PPA" size="10" readonly=true  value="<% =PPA %>" readonly=true style="text-align: Right; font-family: Tahoma; float:none" maxlength="12" style="float: left" tabindex="30"></font></td>
                  </tr>
                  <tr>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma">EFT:</font></td>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma" size="3">
                        <input name="EFT2" size="10" readonly=true  value="<% =EFT2 %>" readonly=true style="text-align: Right; font-family: Tahoma; float:left" maxlength="12" style="float: left" tabindex="30"></font></td>
                  </tr>
                  <tr>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma">Total w/ EFT:</font></td>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma" size="3">
                        <input name="TotWEft" size="10" readonly=true  value="<% =TotWEft %>" readonly=true style="text-align: Right; font-family: Tahoma; float:left" maxlength="12" style="float: left" tabindex="30"></font></td>
                  </tr>
                  <tr>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma">Total w/o EFT:</font></td>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma" size="3">
                        <input type="text" name="TotWOEft" size="10" readonly=true  value="<% =TotWOEft %>" readonly=true style="text-align: Right; font-family: Tahoma" maxlength="50" style="float: left" tabindex="30"></font></td>
                  </tr>
                  <tr>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma">Store PPA:</font></td>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma" size="3">
                        <input type="text" name="StorePPA" size="10" readonly=true  value="<% =StorePPA %>" readonly=true style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: left" tabindex="30"></font></td>
                  </tr>
                  <tr>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma">Store LPPA:</font></td>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma" size="3">
                        <input type="text" name="StoreLPPA" size="10" readonly=true  value="<% =StoreLPPA %>" readonly=true style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: left" tabindex="30"></font></td>
                  </tr>
                  <tr>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma">Per day to Hit Goal:</font></td>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma" size="3">
                        <input type="text" name="PerDayHitGoal" size="10" readonly=true  value="<% =PerDayHitGoal %>" readonly=true style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: left" tabindex="30"></font></td>
                  </tr>
                  <tr>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma">Goal Pace:</font></td>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma" size="3">
                        <input type="text" name="GoalPace" size="10" readonly=true  value="<% =GoalPace %>" readonly=true style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: left" tabindex="30"></font></td>
                  </tr>
                  <tr>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma"># of Memberships:</font></td>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma" size="3">
                        <input type="text" name="NumOfMem" size="10" readonly=true  value="<% =NumOfMem %>" readonly=true style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: left" tabindex="30"></font></td>
                  </tr>
                  <tr>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma">Close%:</font></td>
                        <td width="45%" align="right" nowrap colspan="2">
                        <font face="Tahoma" size="3">
                        <input type="text" name="ClosePercent" size="10" readonly=true  value="<% =ClosePercent %>" readonly=true style="text-align: Right; font-family: Tahoma" maxlength="12" style="float: left" tabindex="30"></font></td>
                  </tr>
                  </table>
            <p><strong><font face="Tahoma" size="4" color="#C58931">Verification</font></strong></p>
            </center></div>
      <p align="center"><font face="Tahoma">
      <input type="submit" name="submit" value="Submit" onClick="document.NightlyStoreNumbers.action='NightlyStoreNumbers3.asp';">
      
      </form>

</body>

</html>


NightlyStoreNumbers3.asp
<%
            Dim RepDate,StoreName,Goal,EFT,DSTotSales,DSSessions,DDTotSales,DDDraftDep,DDSalesTax,DDPaymentAcct,DDInHouse,DDGiftCerts,DDReturnEFT,DDProdSales,DDBonusBucks
            Dim DDPrepaidDlrs,DDMysticMem,DDBuyMem,DDMysticSales,DDMysticSess,DDNewClients,DDTotSess,SBCFreeze,SBCCanRegular,SBCCanFreeze,SBCCanMystTran,SBCCanEft
            Dim      SBCCanTransfer,DaysMonth,DaysRemain
            
            Dim PPA,EFT2,TotWEft,TotWOEft,StorePPA,StoreLPPA,PerDayHitGoal,GoalPace,NumOfMem,ClosePercent,IncrDraft
            Dim calPPA,calTotWEft,calTotWOEft,calStorePPA,calStoreLPPA,calPerDayHitGoal,calGoalPace,calNumOfMem,calClosePercent
            
            Dim ConDB, rsNumbers, strSQL, strAdd
                        

            RepDate = Request.Form("RepDate")
            StoreName = Request.Form("StoreName")
            Goal = Request.Form("Goal")
            EFT = Request.Form("EFT")
            DSTotSales = Request.Form("DSTotSales")
            DSSessions = Request.Form("DSSessions")
            DDTotSales = Request.Form("DDTotSales")
            DDDraftDep = Request.Form("DDDraftDep")
            DDSalesTax = Request.Form("DDSalesTax")
            DDPaymentAcct = Request.Form("DDPaymentAcct")
            DDInHouse = Request.Form("DDInHouse")            
            DDGiftCerts = Request.Form("DDGiftCerts")            
            DDReturnEFT = Request.Form("DDReturnEFT")            
            DDProdSales = Request.Form("DDProdSales")
            DDBonusBucks = Request.Form("DDBonusBucks")            
            DDPrepaidDlrs = Request.Form("DDPrepaidDlrs")            
            DDMysticMem = Request.Form("DDMysticMem")            
            DDBuyMem = Request.Form("DDBuyMem")            
            DDMysticSales = Request.Form("DDMysticSales")            
            DDMysticSess = Request.Form("DDMysticSess")            
            DDNewClients = Request.Form("DDNewClients")            
            DDTotSess = Request.Form("DDTotSess")            
            SBCFreeze = Request.Form("SBCFreeze")            
            SBCCanRegular = Request.Form("SBCCanRegular")            
            SBCCanFreeze = Request.Form("SBCCanFreeze")            
            SBCCanMystTran = Request.Form("SBCCanMystTran")            
            SBCCanEft = Request.Form("SBCCanEft")                        
            SBCCanTransfer = Request.Form("SBCCanTransfer")
            DaysMonth = Request.Form("DaysMonth")
            DaysRemain = Request.Form("DaysRemain")
            NumOfMem = Request.Form("NumOfMem")
            ClosePercent = Request.Form("ClosePercent")
            
                  
            PPA = Request.Form("PPA")
            PPA = FormatCurrency(PPA)
            
            EFT2 = Request.Form("EFT2")
            EFT2 = FormatNumber(EFT2)
            
            TotWEft = Request.Form("TotWEft")
            TotWEFT = FormatNumber(TotWEft)
            
            TotWOEft = Request.Form("TotWOEft")
            TotWOEft = FormatNumber(TotWOEft)            

            StorePPA = Request.Form("StorePPA")
            StorePPA = FormatCurrency(StorePPA)
            
            StoreLPPA = Request.Form("StoreLPPA")
            StoreLPPA = FormatCurrency(StoreLPPA)
            
            PerDayHitGoal = Request.Form("PerDayHitGoal")
            PerDayHitGoal = FormatNumber(PerDayHitGoal)
                         
            GoalPace = Request.Form("GoalPace")
            GoalPace = FormatNumber(GoalPace,2) * 100
            
            NunOfMem = Request.Form("NumOfMem")
            NumOfMem = FormatNumber(NumOfMem)
            
            ClosePercent = Request.Form("ClosePercent")
            ClosePercent = FormatNumber(ClosePercent,2) * 100
            

            strSQL = "INSERT INTO NightlyNumbers1(RepDate,StoreName,Goal,DSTotSales,DSSessions,PPA,EFT,TotWEft,TotWOEft,DDNewClients,DDTotSess,StorePPA,DDProdSales,StoreLPPA,DDMysticSess,DDMysticSales,PerDayHitGoal,GoalPace,NumOfMem,ClosePercent,DDTotSales,DDDraftDep,DDSalesTax,DDPaymentAcct,DDInHouse,DDGiftCerts,DDReturnEFT,DDBonusBucks,DDPrepaidDlrs,DDMysticMem,DDBuyMem,SBCFreeze,SBCCanRegular,SBCCanFreeze,SBCCanMystTran,SBCCanEft,SBCCanTransfer,DaysMonth,DaysRemain,EFT2) " & _
        "VALUES('" & RepDate & "','" & StoreName & "',CONVERT(money,'" & Goal & "'),CONVERT(money,'" & DSTotSales & "'),'" & DSSessions & "',CONVERT(money,'" & PPA & "'),CONVERT(money,'" & EFT & "'),CONVERT(money,'" & TotWEft & "'),CONVERT(money,'" & TotWOEft & "'),'" & DDNewClients & "','" & DDTotSess & "',CONVERT(money,'" & StorePPA & "'),CONVERT(money,'" & DDProdSales & "'),CONVERT(money,'" & StoreLPPA & "'),'" & _
            DDMysticSess & "',CONVERT(money,'" & DDMysticSales & "'),CONVERT(money,'" & PerDayHitGoal & "'),'" & GoalPace & "','" & NumOfMem & "','" & ClosePercent & "',CONVERT(money,'" & DDTotSales & "'),CONVERT(money,'" & DDDraftDep & "'),CONVERT(money,'" & DDSalesTax & "'),CONVERT(money,'" & DDPaymentAcct & "'),CONVERT(money,'" & DDInHouse & "'),CONVERT(money,'" & DDGiftCerts & "'),CONVERT(money,'" & DDReturnEFT & "'),CONVERT(money,'" & DDBonusBucks & "'),CONVERT(money,'" & DDPrepaidDlrs & "'),'" & _
            DDMysticMem & "','" & DDBuyMem & "','" & SBCFreeze & "','" & SBCCanRegular & "','" & SBCCanFreeze & "','" & SBCCanMystTran & "','" & SBCCanEFT & "','" & SBCCanTransfer & "','" & DaysMonth & "','" & DaysRemain & "',CONVERT(money,'" & EFT2 & "'));"
          

            Set conDB = Server.CreateObject("ADODB.Connection")
            conDB.Open "Provider=sqloledb;" & _
           "Data Source=database-server;" & _
           "Initial Catalog=CorpWeb;" & _
           "User Id=empnum;" & _
           "Password=*****"

      On Error Resume Next

            Set strAdd = ConDB.Execute(strSQL)

            If Err.Number <> 0 Then
                Response.Write "<body background='../images/MetalNew1.jpg' style='background-attachment: fixed'>"
                Response.Write "<p><b><font face='Tahoma' color='#C58931'>The following Error has occured:</font></b></p>"
                Response.Write "Number: " & Err.Number & "<br><br>"
                Response.Write "<b>Description: " & Err.Description & "</br><br>"
                Response.Write "<p><font face='Tahoma' color='#C58931'><a href='NightlyStoreNumbers.asp' target='_self' style>Try again</a></font></p>"

                Err.Clear
            Else


%>

<html>

<head>
<title></title>
<style>
a            { text-decoration: none }
a            { text-decoration: none }
</style>

<script language="JavaScript1.2">
window.onload = window.resizeTo(1024,768);
</script>

</head>

<body background="../../images/MetalNew1.jpg" style="background-attachment: fixed">


<H3><font face="Tahoma">Nightly Numbers Added</font></H3>

<P><font face="Tahoma">The following store's Nightly Numbers were added to the database for the date of &nbsp<% =RepDate %>&nbsp:</font></P>
<TABLE>
  <TR>
    <TH ALIGN=RIGHT><font face="Tahoma">Store:</font></TH>
    <TD ALIGN=LEFT><font face="Tahoma"><% =StoreName %></font></TD>
  </TR>
</TABLE>

<p><font face="Tahoma"><a href="NightlyStoreNumbers.asp" target="_self" style>Return</a></font></p>


<% End If %>


TIA,
Andrew
Avatar of kevp75
kevp75
Flag of United States of America image

it doesn't throw a line number at you with the error?
@Ahelbling

Which line number and which line in the code are you getting this error on. Also please paste the string that you are passing to the variable where you are getting this error, we cannot assume what you are passing to that particular variable.
ASKER CERTIFIED SOLUTION
Avatar of bugs021997
bugs021997
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try replacing your insert statement with the below one...


strSQL = "INSERT INTO NightlyNumbers1(RepDate,StoreName,Goal,DSTotSales,DSSessions,PPA,EFT,TotWEft,TotWOEft,DDNewClients,DDTotSess,StorePPA,DDProdSales,StoreLPPA,DDMysticSess,DDMysticSales,PerDayHitGoal,GoalPace,NumOfMem,ClosePercent,DDTotSales,DDDraftDep,DDSalesTax,DDPaymentAcct,DDInHouse,DDGiftCerts,DDReturnEFT,DDBonusBucks,DDPrepaidDlrs,DDMysticMem,DDBuyMem,SBCFreeze,SBCCanRegular,SBCCanFreeze,SBCCanMystTran,SBCCanEft,SBCCanTransfer,DaysMonth,DaysRemain,EFT2) " & _
        "VALUES('" & RepDate & "','" & StoreName & "',CAST('" & Goal & "' as money),CAST('" & DSTotSales & "' as money),'" & DSSessions & "',CAST('" & PPA & "' as money),CAST('" & EFT & "' as money),CAST('" & TotWEft & "' as money),CAST('" & TotWOEft & "' as money),'" & DDNewClients & "','" & DDTotSess & "',CAST('" & StorePPA & "' as money),CAST('" & DDProdSales & "' as money),CAST('" & StoreLPPA & "' as money),'" & _
         DDMysticSess & "',CAST('" & DDMysticSales & "' as money),CAST('" & PerDayHitGoal & "' as money),'" & GoalPace & "','" & NumOfMem & "','" & ClosePercent & "',CAST('" & DDTotSales & "' as money),CAST('" & DDDraftDep & "' as money),CAST('" & DDSalesTax & "' as money),CAST('" & DDPaymentAcct & "' as money),CAST('" & DDInHouse & "' as money),CAST('" & DDGiftCerts & "' as money),CAST('" & DDReturnEFT & "' as money),CAST('" & DDBonusBucks & "' as money),CAST('" & DDPrepaidDlrs & "' as money),'" & _
         DDMysticMem & "','" & DDBuyMem & "','" & SBCFreeze & "','" & SBCCanRegular & "','" & SBCCanFreeze & "','" & SBCCanMystTran & "','" & SBCCanEFT & "','" & SBCCanTransfer & "','" & DaysMonth & "','" & DaysRemain & "',CAST(money,'" & EFT2 & "'));"
Avatar of Andrew

ASKER

@bugs:

Number: -2147217900

Description: The name 'money' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
Avatar of Andrew

ASKER

@all:

DSTotSales = -1149.31

and

PPA = -26.73
Avatar of Andrew

ASKER

@ all:

Microsoft OLE DB Provider for SQL Server error '80040e07'

Cannot convert a char value to money. The char value has incorrect syntax.

/tancoweb/DailyReport/TEST/NightlyStoreNumbers3.asp, line 92
Avatar of Andrew

ASKER

@bugs:

Microsoft OLE DB Provider for SQL Server error '80040e14'

The name 'money' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.

/tancoweb/DailyReport/TEST/NightlyStoreNumbers3.asp, line 91
Avatar of Andrew

ASKER

I also just noticed that the SQL table has the fields PPA and DSTotSales as type MONEY. Could this be a problem with trying to throw -26.73 and -1149.31 in there?
Avatar of Andrew

ASKER

@all:

If i change the DSTotSales to a positive 1149.31, it works. So it is definitely the neagative -1149.31 that is breaking this.
Avatar of Andrew

ASKER

@all:

I got it working - not sure exactly what the effects will be down the road, but it writes to the DB now and the reports look good.

added:                    DSTotSales = FormatNumber(DSTotSales)
                  
changed:            PPA = Request.Form("PPA")
            PPA = FormatNumber(PPA)


New Code:
NightlyStoreNumbers3.asp

<%
            Dim RepDate,StoreName,Goal,EFT,DSTotSales,DSSessions,DDTotSales,DDDraftDep,DDSalesTax,DDPaymentAcct,DDInHouse,DDGiftCerts,DDReturnEFT,DDProdSales,DDBonusBucks
            Dim DDPrepaidDlrs,DDMysticMem,DDBuyMem,DDMysticSales,DDMysticSess,DDNewClients,DDTotSess,SBCFreeze,SBCCanRegular,SBCCanFreeze,SBCCanMystTran,SBCCanEft
            Dim      SBCCanTransfer,DaysMonth,DaysRemain
            
            Dim PPA,EFT2,TotWEft,TotWOEft,StorePPA,StoreLPPA,PerDayHitGoal,GoalPace,NumOfMem,ClosePercent,IncrDraft
            Dim calPPA,calTotWEft,calTotWOEft,calStorePPA,calStoreLPPA,calPerDayHitGoal,calGoalPace,calNumOfMem,calClosePercent
            
            Dim ConDB, rsNumbers, strSQL, strAdd
                        

            RepDate = Request.Form("RepDate")
            StoreName = Request.Form("StoreName")
            Goal = Request.Form("Goal")
            EFT = Request.Form("EFT")
            DSTotSales = Request.Form("DSTotSales")
            DSSessions = Request.Form("DSSessions")
            DDTotSales = Request.Form("DDTotSales")
            DDDraftDep = Request.Form("DDDraftDep")
            DDSalesTax = Request.Form("DDSalesTax")
            DDPaymentAcct = Request.Form("DDPaymentAcct")
            DDInHouse = Request.Form("DDInHouse")            
            DDGiftCerts = Request.Form("DDGiftCerts")            
            DDReturnEFT = Request.Form("DDReturnEFT")            
            DDProdSales = Request.Form("DDProdSales")
            DDBonusBucks = Request.Form("DDBonusBucks")            
            DDPrepaidDlrs = Request.Form("DDPrepaidDlrs")            
            DDMysticMem = Request.Form("DDMysticMem")            
            DDBuyMem = Request.Form("DDBuyMem")            
            DDMysticSales = Request.Form("DDMysticSales")            
            DDMysticSess = Request.Form("DDMysticSess")            
            DDNewClients = Request.Form("DDNewClients")            
            DDTotSess = Request.Form("DDTotSess")            
            SBCFreeze = Request.Form("SBCFreeze")            
            SBCCanRegular = Request.Form("SBCCanRegular")            
            SBCCanFreeze = Request.Form("SBCCanFreeze")            
            SBCCanMystTran = Request.Form("SBCCanMystTran")            
            SBCCanEft = Request.Form("SBCCanEft")                        
            SBCCanTransfer = Request.Form("SBCCanTransfer")
            DaysMonth = Request.Form("DaysMonth")
            DaysRemain = Request.Form("DaysRemain")
            NumOfMem = Request.Form("NumOfMem")
            ClosePercent = Request.Form("ClosePercent")
            
            DSTotSales = FormatNumber(DSTotSales)
                  
            PPA = Request.Form("PPA")
            PPA = FormatNumber(PPA)
            
            EFT2 = Request.Form("EFT2")
            EFT2 = FormatNumber(EFT2)
            
            TotWEft = Request.Form("TotWEft")
            TotWEFT = FormatNumber(TotWEft)
            
            TotWOEft = Request.Form("TotWOEft")
            TotWOEft = FormatNumber(TotWOEft)            

            StorePPA = Request.Form("StorePPA")
            StorePPA = FormatCurrency(StorePPA)
            
            StoreLPPA = Request.Form("StoreLPPA")
            StoreLPPA = FormatCurrency(StoreLPPA)
            
            PerDayHitGoal = Request.Form("PerDayHitGoal")
            PerDayHitGoal = FormatNumber(PerDayHitGoal)
                         
            GoalPace = Request.Form("GoalPace")
            GoalPace = FormatNumber(GoalPace,2) * 100
            
            NunOfMem = Request.Form("NumOfMem")
            NumOfMem = FormatNumber(NumOfMem)
            
            ClosePercent = Request.Form("ClosePercent")
            ClosePercent = FormatNumber(ClosePercent,2) * 100
            

            strSQL = "INSERT INTO NightlyNumbers1(RepDate,StoreName,Goal,DSTotSales,DSSessions,PPA,EFT,TotWEft,TotWOEft,DDNewClients,DDTotSess,StorePPA,DDProdSales,StoreLPPA,DDMysticSess,DDMysticSales,PerDayHitGoal,GoalPace,NumOfMem,ClosePercent,DDTotSales,DDDraftDep,DDSalesTax,DDPaymentAcct,DDInHouse,DDGiftCerts,DDReturnEFT,DDBonusBucks,DDPrepaidDlrs,DDMysticMem,DDBuyMem,SBCFreeze,SBCCanRegular,SBCCanFreeze,SBCCanMystTran,SBCCanEft,SBCCanTransfer,DaysMonth,DaysRemain,EFT2) " & _
        "VALUES('" & RepDate & "','" & StoreName & "',CONVERT(money,'" & Goal & "'),CONVERT(money,'" & DSTotSales & "'),'" & DSSessions & "',CONVERT(money,'" & PPA & "'),CONVERT(money,'" & EFT & "'),CONVERT(money,'" & TotWEft & "'),CONVERT(money,'" & TotWOEft & "'),'" & DDNewClients & "','" & DDTotSess & "',CONVERT(money,'" & StorePPA & "'),CONVERT(money,'" & DDProdSales & "'),CONVERT(money,'" & StoreLPPA & "'),'" & _
            DDMysticSess & "',CONVERT(money,'" & DDMysticSales & "'),CONVERT(money,'" & PerDayHitGoal & "'),'" & GoalPace & "','" & NumOfMem & "','" & ClosePercent & "',CONVERT(money,'" & DDTotSales & "'),CONVERT(money,'" & DDDraftDep & "'),CONVERT(money,'" & DDSalesTax & "'),CONVERT(money,'" & DDPaymentAcct & "'),CONVERT(money,'" & DDInHouse & "'),CONVERT(money,'" & DDGiftCerts & "'),CONVERT(money,'" & DDReturnEFT & "'),CONVERT(money,'" & DDBonusBucks & "'),CONVERT(money,'" & DDPrepaidDlrs & "'),'" & _
            DDMysticMem & "','" & DDBuyMem & "','" & SBCFreeze & "','" & SBCCanRegular & "','" & SBCCanFreeze & "','" & SBCCanMystTran & "','" & SBCCanEFT & "','" & SBCCanTransfer & "','" & DaysMonth & "','" & DaysRemain & "',CONVERT(money,'" & EFT2 & "'));"
          

            Set conDB = Server.CreateObject("ADODB.Connection")
            conDB.Open "Provider=sqloledb;" & _
           "Data Source=database-server;" & _
           "Initial Catalog=CorpWeb;" & _
           "User Id=empnum;" & _
           "Password=*****"

      'On Error Resume Next

            Set strAdd = ConDB.Execute(strSQL)

%>

<html>

<head>
<title></title>
<style>
a            { text-decoration: none }
a            { text-decoration: none }
</style>

<script language="JavaScript1.2">
window.onload = window.resizeTo(1024,768);
</script>

</head>

<body background="../../images/MetalNew1.jpg" style="background-attachment: fixed">


<H3><font face="Tahoma">Nightly Numbers Added</font></H3>

<P><font face="Tahoma">The following store's Nightly Numbers were added to the database for the date of &nbsp<% =RepDate %>&nbsp:</font></P>
<TABLE>
  <TR>
    <TH ALIGN=RIGHT><font face="Tahoma">Store:</font></TH>
    <TD ALIGN=LEFT><font face="Tahoma"><% =StoreName %></font></TD>
  </TR>
</TABLE>

<p><font face="Tahoma"><a href="NightlyStoreNumbers.asp" target="_self" style>Return</a></font></p>
Great...

Cheers