VBAhole22
Registered User.
- Local time
- Today, 16:55
- Joined
- Jan 18, 2002
- Messages
- 117
This problem is keeping me up at night because it seems easy but just gets harder and harder. Here goes: I have a db where each record is a segment of river with nodes at each end. Each record has a from node and a to node. Some records have a value in the waterbody field to designate that they are in a lake (centerline).
Fnode
Tnode
Wb
ArcID
So the question is how can I find the distance to and id of the closest waterbody to each arc?
Well I wrote a simple routine that walks along the river by starting at the first record in the table and leap frogging down successive arcs:
rstNode.Open "SELECT * from clinch WHERE TNODE_ = " & Fnode, cnn, adOpenStatic
Fnode = rstNode!FNODE_
until it reaches a wb and then snags the distance and id. It works great. But the key point is that it walks DOWN the stream. Now I want to go upstream to find the closest upstream waterbody.
Like an idiot I thought I could just flip things around and voila!
No dice. Going upstream is a whole different ballgame because the above query returns multiple records (downstream it doesn't until you reach the last arc).
So the trick is how do I follow each and every arc returned by the above query until it reaches a waterbody and then compare the distances?
Is this what recursive means?
Fnode
Tnode
Wb
ArcID
So the question is how can I find the distance to and id of the closest waterbody to each arc?
Well I wrote a simple routine that walks along the river by starting at the first record in the table and leap frogging down successive arcs:
rstNode.Open "SELECT * from clinch WHERE TNODE_ = " & Fnode, cnn, adOpenStatic
Fnode = rstNode!FNODE_
until it reaches a wb and then snags the distance and id. It works great. But the key point is that it walks DOWN the stream. Now I want to go upstream to find the closest upstream waterbody.
Like an idiot I thought I could just flip things around and voila!
No dice. Going upstream is a whole different ballgame because the above query returns multiple records (downstream it doesn't until you reach the last arc).
So the trick is how do I follow each and every arc returned by the above query until it reaches a waterbody and then compare the distances?
Is this what recursive means?