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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tree View from Access

Status
Not open for further replies.

patrickstrijdonck

Programmer
Jan 18, 2009
97
NL
Hey Guys,

I have tried looking it up on Google but I cannot find what i'm really looking for, Im hoping someone might point me in the right direction;

I have a MS access database with the following tables;

tblStores
tblTickets
tblOrders

What I want is a treeview where I can see if there are open items for a specific store, the tree view should look like this:

-Calls
-StoreA
-StoreB (2)
-StoreC
-Orders
-StoreA (1)
-StoreB
-StoreC (3)

Above, StoreB has 2 tickets open, Store A has 1 Order open and StoreC has 3 orders open.

Thanks
 
you have 2 different concerns
1. getting relational data from the database
2. displaying hierarchical data to the user

you also are require the number of open items per node.
I would solve this by loading nodes on demand. when the page is shown load the root and 1st level children. when a 1st level node is expanded load the second level nodes for that leaf.

another approach would be to load all the relational data when the form is shown, transform that into hierarchical data and bind to the UI, but that is more complicated, and can easily cause performance problems with large sets of data.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
I Managed to get everything in the Treeview as I want, But I cannot see if there is something open for a specific store.

I have fixed this temporary by only showing the stores which has something OPEN in the treeview and put a extra node with all the stores in it.

I cannot figure out that last piece, how to show me a number behind a store, which tells me how many calls there are open for that specific store
 
the display value of the node is just text, so format the display text from the results of the query
1. select id, name, count(open orders) from table where ...
2. format text
var displayText = string.Format("{0} ({1})", Name, NumberOfOrderOrders);
3. bind displayText to tree node (and id as the value if necessary)


Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top