Users are getting Type Mismatch on 'Formatcurrency' when they scrolled to the bottom

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samytee
    New Member
    • Aug 2013
    • 2

    #1

    Users are getting Type Mismatch on 'Formatcurrency' when they scrolled to the bottom

    The following lines of code return error message
    Microsoft VBScript runtime error '800a000d'
    Type mismatch: 'FormatCurrency '
    /UnetER/sam_CCMSamEditR ules_Bottom.asp , line 51

    When users scrolled down the bottom of a report written in ASP and running on Windows 7


    Here is the lines of code:



    Code:
    <% if objRecordSet("IncorrectAmount") = 0 then %> 
        <td align="right">*</td> 
    <%else%> 
        <td align="right">
            <%=formatcurrency(objRecordSet("IncorrectAmount"))%>*
        </td> 
    <%end if%>
    Last edited by Frinavale; Sep 5 '13, 01:18 PM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You probably have a null value. You need to decide how you want to handle nulls.

    Comment

    • samytee
      New Member
      • Aug 2013
      • 2

      #3
      For nulls, I want to display blank. How do I get around that?

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Use an if structure.

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          Just to elaborate, in VB, null is Nothing.

          Your if structure should check for Nothing.

          For example:
          Code:
          If myVariable Is Nothing Then
            '...it is nothing
          End If
          However, your code appears to be taking from a Record Set (based on your variable name). So you need may need to check if the value is DBNull using the IsDBNull Function.

          For example
          Code:
          If IsDBNull(myVariable) Then
            '... it is null/nothing
          End If

          Comment

          Working...