Quantcast
Channel: Classic ASP
Viewing all articles
Browse latest Browse all 488

Receiving Microsoft VBScript runtime error 800a0009 Subscript out of range '3' /mydirectory/mypage, line 196

$
0
0

I am receiving  the error:

Receiving Microsoft VBScript runtime error 800a0009 Subscript out of range '3' /mydirectory/mypage, line 196

in one of the list boxes on the page. It occurs on only a few items selected

I have 3 cascading list boxes on the page. County, City & Court. When I select certain city names from the City list box I receive the error. I cannot, for the life of me figure this out. I don't if it's being caused by the SELECT statement or the list box itself

Here's the code for the SELECT statement:

' did user choose a subcategory from the drop down list the
' last time on this page?
subcatChosen = Request.Form("SubCategorySelect")
showsubSubcat = False
If (("X" & subcatChosen) <> "X") AND (subcatChosen <> "NONE") Then
    ' yes, he/she did
    ' make sure that chosen category type matches DB field type for query
    subcatChosen = CInt(subcatChosen)
    ' and say we *will* show subcategories
    showsubSubcat = True
    ' so get the list of subcategories for given category
    Set subsubRS = catConn.Execute("SELECT citiesID, courtsCourt " _& " FROM tblcourts" _& " WHERE citiesID=" & subcatChosen _& " ORDER BY courtsCourt")
    ' and, again, convert the record set to an array
    subsubRows = subsubRS.getRows
    subsubRS.Close
    Set subsubRS = nothing
End If

and here is the code for the list box itself:

<SELECT class="select listbox2" Name="SubSubcategorySelect" MULTIPLE Size=10 onChange="goNextPage(this);" ><% If showsubSubcat = False Then %><OPTION Value="0">-- No Courts yet --<% Else %><OPTION Value="0">-- Choose a Court below --<% For cnum = 0 To UBound(subsubRows,2) %><OPTION Value="<%= subRows(0,cnum) %>"><%= subsubRows(1,cnum) %><% Next %><% End If %></SELECT>

I would greatly appreciate any advice, suggestions or insight into what could be causing this problem. If I need to include more information or code, please let me know.

Thank you in advance

Mike


Viewing all articles
Browse latest Browse all 488

Trending Articles