Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recursion in VB

Status
Not open for further replies.

gazflat33

Technical User
Nov 22, 2002
13
GB
I have an access table which contains employee information. In this table each employee has a line manager which relates to another employee in the same table. I can get VB to display the employee heirarchy via a tree view, and can change an employees line manager.
All line managers take a cut of their underlings wages. I need to be able to use recursion so that when an employee changes their line manager it recalculates the wages for each employee down the heirarchy.
Please help,

Gaz
 
Why do you need to use recursion? (You can, of course.) What's the "it" that does the recalculating?

Context, context...

With what you have there, you could just set up an empty recordset of managers, and scan through the employees table. When you hit an employee, do a find on the managers recordset. If the manager isn't found, add it, and put the cut of the present employee's salary to which the manager is entitled. If it is found, add same to the present value.

Bob Rodes
 
[tt]
^
/_\[/tt]Pyramid???

Since you are using a treeview and I am guessing you are using some form of drag-n-drop to realign your tree... couldn't you, in the drop event, do your calculations there via using the node child and parent information?


Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top