It depends on how your database is setup.
I use a recursive function that takes the id of the category then checks to see if it has any sub categories associated with it.
For this type of system you would require a new table and use joins to extract the data.
Code:
Function listSubCat(CatID, Counter)
SubCat__MMColParam = CatID
Set SubCat = Server.CreateObject("ADODB.Recordset")
SubCat.ActiveConnection = MM_MenuSystem_STRING
SubCat.Source = "SELECT Category.CatID, Category.CatName FROM Category INNER JOIN SubCat ON Category.CatID = SubCat.CatID WHERE (((SubCat.SubCatID)= " + Replace(SubCat__MMColParam, "'", "''") + ")) ORDER BY Category.CatName"
SubCat.CursorType = 0
SubCat.CursorLocation = 2
SubCat.LockType = 1
SubCat.Open()
If Not SubCat.EOF Or Not SubCat.BOF Then
While NOT SubCat.EOF
Response.Write Space(2+Counter) & "<ul>" & vbCRLF
Response.Write Space(4+Counter) & "<li>"
Response.Write "<em>"
Response.Write SubCat("CatName") & " (CategoryID " & SubCat("CatID") & ")"
Response.Write "</em>" & vbCRLF
Counter = Counter + 4
Call listSubCat(SubCat("CatID"), Counter)
Call listLink(SubCat("CatID"), Counter)
Counter = Counter - 4
Response.Write Space(4+Counter) & "</li>" & vbCRLF
Response.Write Space(2+Counter) & "</ul>" & vbCRLF
SubCat.MoveNext()
Wend
End If ' end Not SubCat.EOF Or NOT SubCat.BOF
SubCat.Close()
Set SubCat = Nothing
End Function
http://computer-helpforum.com/asp/as...ystem_List.asp