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]/BatchReportCRInfo2.asp[/size][/font][font=Arial][size=2], line 319[/size][/font] else DL=cint(dispersion_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. -
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!
13 6920
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>/BatchReportCRInfo2.asp</font><font face="Arial" size=2>, line 319</font>
<pre>else DL=cint(dispersion_lower)
^</pre> [/HTML]
[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'
/BatchReportCRInfo2.asp, line 319 else DL=cint(dispersion_lower)^[/HTML]
If I'm reading it right, these three lines look wrong. -
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 : - if (condition) then
-
'(code to execute)
-
else
-
'(code to execute)
-
end if
Yours looks like it is halfway between this and a single-line if statement: - if (condition) then (code to execute)
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
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: -
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
-
But, Jared, the error has changed. It is now:
[HTML]
Microsoft JScript runtime error '800a138f'
Object expected
/_ScriptLibrary/DataGrid.ASP, line 403
[/HTML]
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!
I have also tried doing it this way: -
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...
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: -
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. ;-)
The object expected error is usually a syntax problem. Which line is that?
Jared
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]
sorry: -
strHTML += eval(this.colData[nCol]);
-
-
sorry: -
strHTML += eval(this.colData[nCol]);
-
-
hmm. Any idea what is being passed to nCol?
Jared
Well, where it is performing this function is in a grid, and here is the code which produces that column of the grid: -
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 "QDispersion" 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: -
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
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Matthew Louden |
last post by:
I have no idea what's wrong with the following ASP statement:
Response.Write "<select name=\"id\">"
MS VBScript Compilation error 800a0401
expected end of statement
However, if I do the...
|
by: Adam Short |
last post by:
Can anyone help?
I have all of a sudden started to receive this error on my site!
I have no idea what script it is executing, why it is now failing, what is
going on??
All I have been able...
|
by: Adam Short |
last post by:
Can anyone help?
I have all of a sudden started to receive this error on my site!
I have no idea what script it is executing, why it is now failing, what is
going on??
All I have been able...
|
by: remya1000 |
last post by:
While running the program, i'm getting this error
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/admin/currentmonth.asp, line 26
strSQL = "SELECT...
|
by: delaney19 |
last post by:
Hi im getting this error on line 5 where i start the sub, and i have no idea why so if anyone could help i would be very gratefull.
Imports System
Imports System.DirectoryServices
Namespace...
|
by: char |
last post by:
I can't figure out why I am getting error: Microsoft VBScript compilation '800a0400'
SET MyRecordSet = SERVER.CREATEOBJECT("ADODB.RECORDSET")
MySQL = "SELECT * FROM ShipSummary (NOLOCK) where...
|
by: Indy |
last post by:
Hi,
I am new to VB and have some previous programming experiences.
Curently working as an IT support person and trying to write a VB 6 script to access apos database and get one of the table's...
|
by: kevinr |
last post by:
Hi, I am brand new to VB, and I am trying to deploy Office 2007 on my network here at work. We used part of this script to do another deployment, and I have taken pieces and tried to edit for this...
|
by: sarahj |
last post by:
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/forms/lgctest.asp, line 17
Dim name,municipal position,municipality,address,city,state,zip,email
here's my...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |