I have a database table that contains a list of categories. The table schema is:

catID
catText
superCatID

Where catID is an AutoNumber field, and superCatID points to the parent of a category (this may be null, for a top level category)


And a possible table might be:
Code:
catID   catText   superCatID
1       A        
2       B
3       C
4       AA        1
5       AB        1
6       BA        2
7       BB        2
8       ABA       5
9       CA        3
10      ABAA      8


I want a function that will parse this table, or whatever, and build a structured list of the categories, to fill a combo. This is to simplify a UI, so that catIDs don't have to be remembered.

e.g, the above table should come out looking something like:
Code:
A        
-AA
-AB
--ABA
---ABAA
B
-BA
-BB
C
-CA


Now, who wants to be the genius that solves this one?