VBScript compilation error '800a03f6' expected end

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mdock
    New Member
    • Nov 2007
    • 12

    VBScript compilation error '800a03f6' expected end

    Hello everyone,
    I am attempting to add a function to an existing ASP page. The default script of the page is VBScript. The page is returning the following error:


    Microsoft VBScript compilation [font=Arial][size=2]error '800a03f6'[/size][/font][font=Times New Roman][size=3] [/size][/font]

    [font=Arial][size=2]Expected 'End'[/size][/font]

    [font=Arial][size=2]/BatchReportCRIn fo2.asp[/size][/font][font=Arial][size=2], line 319[/size][/font] else DL=cint(dispers ion_lower)^I know these errors aren't always what they say they are, but I guess I should start with the obvious. Here is the code for the function, starting with line 316. This is my first time posting so I hope I do it right.

    Code:
    function dspchk(QDispersion,dispersion_lower,dispersion_upper)
       if QDispersion>0 then QD=cint(QDispersion)
    	  if (isNull(dispersion_lower) or rtrim(dispersion_lower)="") then DL=0
    		 else DL=cint(dispersion_lower)
    	  end if
    	  if (isNull(dispersion_upper) or rtrim(dispersion_upper)="" or dispersion_upper=0) then DU=5
    		 else DU=cint(dispersion_upper)
    	  end if
    	  if (DL>QD or QD>DU) then dspchk="<font color=red><b>OOS: " & QD & "</b></font>"
    		 else dspchk=QD
    	  end if
       else dspchk=QDispersion
       end if
    end function
    Thanks in advance for your help!
  • mdock
    New Member
    • Nov 2007
    • 12

    #2
    Sorry, I forgot the HTML tags around the error. Here it is:

    [HTML]



    <font face="Arial" size=2>
    <p>Microsoft VBScript compilation </font> <font face="Arial" size=2>error '800a03f6'</font>
    <p>
    <font face="Arial" size=2>Expected 'End'</font>
    <p>
    <font face="Arial" size=2>/BatchReportCRIn fo2.asp</font><font face="Arial" size=2>, line 319</font>
    <pre>else DL=cint(dispers ion_lower)
    ^</pre> [/HTML]

    Comment

    • mdock
      New Member
      • Nov 2007
      • 12

      #3
      [font=Verdana][size=2]OK, well, maybe not. I'm going to try one more time:[/size][/font]
      [font=Verdana][/font]
      <FONT face=Verdana size=2>[HTML]



      Microsoft VBScript compilation error '800a03f6'

      Expected 'End'

      /BatchReportCRIn fo2.asp, line 319 else DL=cint(dispers ion_lower)^[/HTML]

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        If I'm reading it right, these three lines look wrong.
        Code:
        	  if (isNull(dispersion_lower) or rtrim(dispersion_lower)="") then DL=0
        		 else DL=cint(dispersion_lower)
        	  end if
        If...else statements that are on more than one line should be in the form : [code=asp]if (condition) then
        '(code to execute)
        else
        '(code to execute)
        end if[/code]
        Yours looks like it is halfway between this and a single-line if statement:
        [code=asp]if (condition) then (code to execute)[/code]notice if you put the code to execute on the same line as the if and condition, there is no end if (I didn't think you could use "else" either, but I could be wrong. Let me know if this helps.

        Jared

        Comment

        • mdock
          New Member
          • Nov 2007
          • 12

          #5
          Jared,
          Thanks so much for your reply. I reformatted the code to match the format you suggested, but I am still getting the error.
          Just for the record, my code now looks like this:
          Code:
          function dspchk(QDispersion,dispersion_lower, dispersion_upper)
          if QDispersion>0 then
          	QD=cint(QDispersion)
          	if (isNull(dispersion_lower) or rtrim(dispersion_lower)="") then
          		DL=0
          	 else
          		DL=cint(dispersion_lower)
          	end if
          	if (isNull(dispersion_upper) or rtrim(dispersion_upper)="" or dispersion_upper=0) then
          		DU=5
          	 else
          		DU=cint(dispersion_upper)
          	end if
          	if (DL>QD or QD>DU) then
          		dspchk="<font color=red><b>OOS: " & QD & "</b></font>"
          	 else
          		dspchk=QD
          	end if
          else
          	dspchk=QDispersion
          end if
          end function

          Comment

          • mdock
            New Member
            • Nov 2007
            • 12

            #6
            But, Jared, the error has changed. It is now:
            [HTML]
            Microsoft JScript runtime error '800a138f'

            Object expected

            /_ScriptLibrary/DataGrid.ASP, line 403
            [/HTML]

            Comment

            • mdock
              New Member
              • Nov 2007
              • 12

              #7
              Oh and by the way, that space in the word "upper" in line 1 isn't really there, it just showed up that way in the post for some reason.
              Thanks!

              Comment

              • mdock
                New Member
                • Nov 2007
                • 12

                #8
                I have also tried doing it this way:
                Code:
                function dspchk(QDispersion,dispersion_lower,dispersion_upper)
                if QDispersion>0 then
                	QD=cint(QDispersion)
                else
                	dspchk=QDispersion
                	exit function
                end if
                if (isNull(dispersion_lower) or rtrim(dispersion_lower)="") then
                	 DL=0
                else
                	 DL=cint(dispersion_lower)
                end if
                if (isNull(dispersion_upper) or rtrim(dispersion_upper)="" or dispersion_upper=0) then
                	 DU=5
                else
                	 DU=cint(dispersion_upper)
                end if
                if (DL>QD or QD>DU) then
                	 dspchk="<font color=red><b>OOS: " & QD & "</b></font>"
                else
                	 dspchk=QD
                end if
                end function
                and I still get the "object expected" error. rrrrr...

                Comment

                • mdock
                  New Member
                  • Nov 2007
                  • 12

                  #9
                  Here is another thing I have tried. I read somewhere that if one of the commands executed by an if/then/else statement is "end function," there will be problems because it never reads the "end if" and so the statement is not closed properly. Or something like that! So I tried this:
                  Code:
                  function dspchk(QDispersion,dispersion_lower,dispersion_upper)
                  if (isNull(QDispersion) or rtrim(QDispersion)="" or QDispersion="0") then dspchk=QDispersion : exit function
                  if QDispersion>0 then QD=cint(QDispersion)
                  if (isNull(dispersion_lower) or rtrim(dispersion_lower)="") then
                  	DL=0
                  else
                  	DL=cint(dispersion_lower)
                  end if
                  if (isNull(dispersion_upper) or rtrim(dispersion_upper)="" or dispersion_upper=0) then
                  	DU=5
                  else
                  	DU=cint(dispersion_upper)
                  end if
                  if (DL>QD or QD>DU) then
                  	dspchk="<font color=red><b>OOS: " & QD & "</b></font>"
                  else
                  	dspchk=QD
                  end if
                  end function
                  Basically just trying to get the "exit function" out of an "else" statement where it would be looking for an "end if." Alas, I still get the "object expected error." But, as you can see, I am trying really hard. ;-)

                  Comment

                  • jhardman
                    Recognized Expert Specialist
                    • Jan 2007
                    • 3405

                    #10
                    The object expected error is usually a syntax problem. Which line is that?

                    Jared

                    Comment

                    • mdock
                      New Member
                      • Nov 2007
                      • 12

                      #11
                      The line it is referring to is in the file scriptlibrary/datagrid.asp which says it is copyrighted by Microsoft. (In other words, I didn't write it.) And line 403 is this:

                      [size=1]strHTML [/size][size=1][color=#0000ff]+= [/color][/size][size=1]eval([/size][size=1][color=#840084]this[/color][/size][size=1].colData[nCol]);

                      [/size]

                      Comment

                      • mdock
                        New Member
                        • Nov 2007
                        • 12

                        #12
                        sorry:

                        Code:
                        strHTML += eval(this.colData[nCol]);

                        Comment

                        • jhardman
                          Recognized Expert Specialist
                          • Jan 2007
                          • 3405

                          #13
                          Originally posted by mdock
                          sorry:

                          Code:
                          strHTML += eval(this.colData[nCol]);
                          hmm. Any idea what is being passed to nCol?

                          Jared

                          Comment

                          • mdock
                            New Member
                            • Nov 2007
                            • 12

                            #14
                            Well, where it is performing this function is in a grid, and here is the code which produces that column of the grid:

                            Code:
                            Grid1.colAttributes[4] = ' align=center';
                            Grid1.colFormat[4] = '<Font Size=2 Face="Arial" Color=Black >';
                            Grid1.colData[4] = 'dspchk(rsProduction.fields.getValue(\'QDispersion\'),rsProduction.fields.getValue(\'dispersion_lower\'),rsProduction.fields.getValue(\'dispersion_upper\'))';
                            Those spaces in the code after "QDispersio n" and in the middle of "upper" aren't really there, they just appear in the post for some reason.

                            Here is the other code related to column 4 of the grid:

                            Code:
                            Grid1.headerWidth[4] = '';
                             
                            Grid1.colHeader[4] = '\'QDispersion\'';
                            I am just picking out this column because it is the one I have been working on; the other columns remain the same as they were when the page did not return an error.

                            Thanks!!
                            Mare

                            Comment

                            Working...