Hello,

I've a connection table in access database as below:

ID FROM_NODE TO_NODE
---------------------
1 10 11
2 10 12
3 11 10
4 11 13
5 11 14
6 12 10
7 12 13
8 12 15
9 13 12
10 13 14
11 13 16
12 14 13
13 14 11
14 14 17
15 15 12
16 15 16
17 16 15
18 16 13
19 16 17
20 17 16
21 17 14

I would like to calculate the depth of each node relative to a start node,
say the start node is 15, then the depth table is show as below, node 12 and 16 is directly linked to node 15, so the depth is 1. Node 10, 13, 17 are 2 steps from node 15, so the depth is 2, and so on.

ID NODE DEPTH
-------------------------
1 10 2
2 11 3
3 12 1
4 13 2
5 14 3
6 15 0
7 16 1
8 17 2

How could I make the looping in vb so to obtain the depth table?
I'm quite confused in handling loops in loops.
Thanks for help