% Sub GetSubMenus(intMenuID, intLevel, intCounterx, bRSEnd) strSQL = "(SELECT *, 1 AS 'Subs' "&_ "FROM CMS_Menu "&_ "WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID = "& intMenuID &" AND "&_ "MenuID IN (SELECT DISTINCT MainMenuID "&_ " FROM CMS_Menu "&_ " WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID IS NOT NULL)) "&_ "UNION "&_ "(SELECT *, 0 AS 'Subs' "&_ "FROM CMS_Menu "&_ "WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID = "& intMenuID &" AND "&_ "MenuID NOT IN (SELECT DISTINCT MainMenuID "&_ " FROM CMS_Menu "&_ " WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID IS NOT NULL)) "&_ "ORDER BY MenuOrder" set rsSubMenu = con.execute(strSQL) i_SubLoopCounter = 0 do while not rsSubMenu.EOF i_MenuID = rsSubMenu("MenuID") i_MenuSectionID = rsSubMenu("MenuSectionID") s_MenuName = rsSubMenu("MenuName") i_MenuOrder = rsSubMenu("MenuOrder") i_MainMenuID = rsSubMenu("MainMenuID") i_PageID = rsSubMenu("PageID") s_Frame = rsSubMenu("Frame") b_Subs = rsSubMenu("Subs") %>
<%if Not bRSEnd then%>
<%else%>
<%end if%>
<%For y = 1 to intLevel%>
<%if Not bRSEnd then%>
<%else%>
<%end if%>
<%Next%>
<%rsSubMenu.movenext%>
<%if rsSubMenu.EOF then%>
<%else%>
<%end if%>
<%if CInt(b_Subs) = 1 then%>
<%else%>
<%end if%>
<%=s_MenuName%>


Link