Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1763
Number of posts: 4498

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
ASP vbscript error Posted by apenticoff on 9 Aug 2006 at 12:22 PM
I simply want to run vbcode in the Head portion of the web page to determine if an error occurred. If so, I want to change the backcolor of the screen to red.
In my VBScript version, I get an error at the subroutine calling line
"Type mismatch"

I've tried using a subroutine and a function. I have tried passing parameters and not passing parameters.
Here is the code

<html><head>
<!--
This screen is the Inventory location entry
-->

<script TYPE="text/vbScript">

sub AMakeRed()
backcolor = red
end sub
</script>

<script TYPE="javaScript">
function mainmenu()
{
document.forms[0].action="InventoryMenu.asp";
document.forms[0].submit();
}

</script>

<TAble align="center"><tr><td>
<B> Move Unit Screen </B>
</td></tr></Table>

<%
Dim ErrArr(10)

If request.form("LastScreen") = "InventoryMove1.asp" then
'See if the location to Move to is a valid location
set Conn = server.createobject("ADODB.Connection")
Conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=TN-MEM-TS1;DATABASE=Brother; User Id=webuser; Password=webuser;"

Set Loc = Server.CreateObject("ADODB.Recordset")

SQL = "Select * from InventoryLocs where Location = '" & request.form("MoveTo") & "'"
Loc.Open SQL,Conn,1,2
If Loc.EOF then
EditsPassed = "N"
ECount = ECount + 1
ErrArr(ECount) = "Invalid Move to Location "
ErrArr(4) = SQL
' Makered1()

Else
If Loc("LocType") = "SWAP" then
response.redirect("InventoryMove2S.asp")
Else
Response.redirect("InventoryMove2NS.asp")
End if
End IF
Loc.Close
set Loc = nothing

If len(request.form("MoveTo") )> 1 and ECount > 0 then
' response.redirect("InventoryMove1.asp")
end if

End if

%>
</head>
<form name="InventoryMoveUnit1" action="InventoryMove1.asp" method="Post" target="_parent">
<body OnLoad="document.InventoryMove1.Location.focus();" bgcolor="#FFFFCC">

<Table align="Center">

<tr>
<TD>Move to Location &nbsp </td>
<TD><Input type="Text" size="5" Name="MoveTo" ></td>
</tr>
<% If ECount > 0 then
AMakeRed() ' <---This line causes a Type mismatch error
%>
<tr>
<TD colspan="2"><B>Move to Location Invalid </td>
</tr>

<% End if %>
</Table>

<Input type="hidden" value="InventoryMove1.asp" name="LastScreen">
<Input type="HIDDEN" value="TEST" name="Tst">

<Table align="Center">
<TR>
<TD>

</td></tr>
<TR><td>&nbsp</TD></TR>
<TR><td>
<Input type="button" value="Main Menu" name="UserID" onClick="mainmenu()">
</td></tr></table>

</form>
</body>
</html>

Can you see the error?
Report
Re: ASP vbscript error Posted by creeshna on 31 Aug 2006 at 12:24 PM
: I simply want to run vbcode in the Head portion of the web page to determine if an error occurred. If so, I want to change the backcolor of the screen to red.
: In my VBScript version, I get an error at the subroutine calling line
: "Type mismatch"
:
: I've tried using a subroutine and a function. I have tried passing parameters and not passing parameters.
: Here is the code
:
: <html><head>
: <!--
: This screen is the Inventory location entry
: -->
:
: <script TYPE="text/vbScript">
:
: sub AMakeRed()
: backcolor = red
: end sub
: </script>
:
: <script TYPE="javaScript">
: function mainmenu()
: {
: document.forms[0].action="InventoryMenu.asp";
: document.forms[0].submit();
: }
:
: </script>
:
: <TAble align="center"><tr><td>
: <B> Move Unit Screen </B>
: </td></tr></Table>
:
: <%
: Dim ErrArr(10)
:
: If request.form("LastScreen") = "InventoryMove1.asp" then
: 'See if the location to Move to is a valid location
: set Conn = server.createobject("ADODB.Connection")
: Conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=TN-MEM-TS1;DATABASE=Brother; User Id=webuser; Password=webuser;"
:
: Set Loc = Server.CreateObject("ADODB.Recordset")
:
: SQL = "Select * from InventoryLocs where Location = '" & request.form("MoveTo") & "'"
: Loc.Open SQL,Conn,1,2
: If Loc.EOF then
: EditsPassed = "N"
: ECount = ECount + 1
: ErrArr(ECount) = "Invalid Move to Location "
: ErrArr(4) = SQL
: ' Makered1()
:
: Else
: If Loc("LocType") = "SWAP" then
: response.redirect("InventoryMove2S.asp")
: Else
: Response.redirect("InventoryMove2NS.asp")
: End if
: End IF
: Loc.Close
: set Loc = nothing
:
: If len(request.form("MoveTo") )> 1 and ECount > 0 then
: ' response.redirect("InventoryMove1.asp")
: end if
:
: End if
:
: %>
: </head>
: <form name="InventoryMoveUnit1" action="InventoryMove1.asp" method="Post" target="_parent">
: <body OnLoad="document.InventoryMove1.Location.focus();" bgcolor="#FFFFCC">
:
: <Table align="Center">
:
: <tr>
: <TD>Move to Location &nbsp </td>
: <TD><Input type="Text" size="5" Name="MoveTo" ></td>
: </tr>
: <% If ECount > 0 then
: AMakeRed() ' <---This line causes a Type mismatch error
: %>
: <tr>
: <TD colspan="2"><B>Move to Location Invalid </td>
: </tr>
:
: <% End if %>
: </Table>
:
: <Input type="hidden" value="InventoryMove1.asp" name="LastScreen">
: <Input type="HIDDEN" value="TEST" name="Tst">
:
: <Table align="Center">
: <TR>
: <TD>
:
: </td></tr>
: <TR><td>&nbsp</TD></TR>
: <TR><td>
: <Input type="button" value="Main Menu" name="UserID" onClick="mainmenu()">
: </td></tr></table>
:
: </form>
: </body>
: </html>
:
: Can you see the error?
:

dude, i just removed your 'type=' thing in your script tag nd replaced it with 'language = '. It goes to InventoryMenu.asp; I suppose the error is gone. remove text\vbscript too...change it vbscript. Things should work. Cheers...



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.