Thanks Kerry I'm starting to understand, got no experience of cfscript but it seems a lot like actionscript.
Unfortunately I've tried to run the code and I'm getting the following error. Context validation error for tag cfscript. The start tag must have a matching end tag. An explicit end tag can be provided by adding </cfscript>. If the body of the tag is empty you can use the shortcut <cfscript .../>. This is the exact code.... <cfquery datasource="#DSN#" name="getAllCategories"> SELECT itemid,parentitemid,adcategoryname FROM tblAdvertTypes </cfquery> <cfscript> variables.inst.menuqry = getAllCategories; function buildmenu(currentid,depth){ var i=0; for(i=1; i lte parentitemid.menuqry.recorcount; i=i+1){ if(variables.inst.menuqry.parentitemid[i] eq arguments.currentID) writeoutput(repeatstring(">",arguments.depth)&variables.menuqry.adcategoryname[i]&"<br>"); buildmenu(variables.inst.menuqry.itemid[i],arguments.depth+1); } } buildmenu(10,0) </cfscript> Steve ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222308 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54