Solved

Recursive code in VB access of a Predecessor and Succesor to step through all trees

Posted on 2009-05-13
8
364 Views
Last Modified: 2013-11-27
I Am building up a tree hirearcy in accss (vb) which require code to climb through a table and running down and back as this type of hirearcy code does, as an example
1 - 2
1 - 3
     3- 5
         5 - 6
      3 - 9
      3 -10
1 - 4 ECT
I just need the code to climb around in the table using the numbers in 2 fields. I have the code in C# but not in  vb any help or good resourse pages would be handy
trhanks in advoce

0
Comment
Question by:sydneyguy
  • 5
  • 3
8 Comments
 
LVL 3

Expert Comment

by:coleventures
ID: 24381867
http://www.codechanger.com/

Take a look at this.  I searched the web for converting c# to vb and found this.

It is an immediate converter.

It also converts from vb to c#.

Since I really only know vb I entered a sample if/then/else construct.

if a = b then
   c = d
else
   e = f
end if

the result displayed was:
if (a == b) {
      c = d;
}
else {
      e = f;
}
0
 

Author Comment

by:sydneyguy
ID: 24381928
Sorry I might have worded it wrong or maybe I missunder stand you question so I will try to elaberate,
I have a table that has a predecessor and a Successor as you would in windows explorer, I need to crawl through the table and climb down throug the tree and test for certain vlues as it goes,
Now these are not folders they are fields in a table
i have included a  diagram of what the data to be and the diagram of what would be represented and were the code would have to cllimb to pick up every number. Again these are not folders but just numbers were the folders repreent the tree arm represented by the numbers
garry                            
layout.jpg
0
 

Author Comment

by:sydneyguy
ID: 24381934
were the first column is the precessor and the 2nd column is the successor
0
 
LVL 3

Expert Comment

by:coleventures
ID: 24382031
I read that "i have the code in C#" and thought you'd only need to translate this code to VB in order to get your result.

Can you elaborate the problem with which you need help?

Try a real life example.
This would help me and other experts zero in on the best answer for you.

Robert
Louisiana - USA
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:sydneyguy
ID: 24382098
thanks robert for  your input.in real life
there is a table in  msproject "task dependences"  that has two f fields in it PredeccessorTaskUnique ID and SuccessorTaskUniqueID and the form a hirarical tree depending on how you join the components together in project, what i need to do is to start at the top of the tree and crawl through the table and go down through every number and it children to the next child tillit runs out of children  and then climb back and continue on till all has been serched. all branches, thats it, its just a recursive algarisim but done in VB.  the table above is what would appear in project .

0
 
LVL 3

Accepted Solution

by:
coleventures earned 500 total points
ID: 24382153
Do you mean you'd like to be able to display via a report this multilevel/heirarcy?

Another way of saying this is that you want to take a flat table and print a relation that goes many levels deep.

Level 1
       Level 2
Level 1
       Level 2
              Level 3
                    Level 4
Level 1
        Level 2

#1 is Level 1
#s 2 and 5 would be level 2
#s 3,4,6,7,12,13 would be level 3
and so on.

Robert
Louisiana - USA
0
 

Author Comment

by:sydneyguy
ID: 24383807
Yes what you say is exactly that, but once I have the code i can make and intellegent decisions and disect the data that the multilevel/heirarcy? returns so yes this is what i am after, any ideas???
garry
0
 

Author Closing Comment

by:sydneyguy
ID: 31581313
thanks for the input sorry for the delay was out of network coverage for several weeks

thanks for the info, i have used the info to get started thanks for the help
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now