Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

ASP vbscript error

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






sub AMakeRed()
backcolor = red
end sub



function mainmenu()
{
document.forms[0].action="InventoryMenu.asp";
document.forms[0].submit();
}



Move Unit Screen

<%
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

%>



<% If ECount > 0 then
AMakeRed() ' <---This line causes a Type mismatch error
%>
<% End if %>
Move to Location &nbsp
Move to Location Invalid





&nbsp







Can you see the error?

Comments

  • creeshnacreeshna Member Posts: 4
    : 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
    :
    :
    :
    :
    :
    :
    : sub AMakeRed()
    : backcolor = red
    : end sub
    :
    :
    :
    : function mainmenu()
    : {
    : document.forms[0].action="InventoryMenu.asp";
    : document.forms[0].submit();
    : }
    :
    :
    :
    :

    : Move Unit Screen
    :
    :
    : <%
    : 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
    :
    : %>
    :
    :
    :
    :
    :
    :
    :
    : : : : <% If ECount > 0 then
    : AMakeRed() ' <---This line causes a Type mismatch error
    : %>
    :
    : : :
    : <% End if %>
    :
    Move to Location &nbsp
    Move to Location Invalid
    :
    :
    :
    :
    :
    :
    : : :

    :
    :
    &nbsp

    :
    :
    :
    :
    :
    :
    :
    : 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 textvbscript too...change it vbscript. Things should work. Cheers...
Sign In or Register to comment.