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

Multi-Select DataGrid

Status
Not open for further replies.

HobbitK

Technical User
Jan 14, 2003
235
US
Hi everyone ... I currently have a Datagrid connected to a few fields of a single table(I used a DataEnvironment and DECommand to do that). The DataGrid only shows the "Main" topics. I now need to design a method of retreiving/displaying ALL the info. on the selected items in the datagrid.
Say the DataGrid is retreiving "Company","Contact" and "Phone#" from tblCustomers. Now I need to display items like "Fax#","Orders", etc.etc. (similar to OrderDetails table in Northwind DB). I was thinking of just using a second datagrid, using the Text property of the selected item to build the SQL to get what I need. I have accomplished that IF only one item is selected, but I would like to have the ability to allow multi-selections of the Datagrid, then display all the needed info. for each item selected. I can get the Index of each item selected, using the SelBookmarks property, but am stumped on getting the Text property of each. So far, all my tries has returned the Text of the first selected column multiple times.
Any ideas?
P.S. If I am using the wrong control for this, please say so... I am early enough in the design portion of this, that changing it now would not be a problem.
Thanks,
Michael
 
1. Set a Recordset Clone to the grid's underlying recordset

2.Loop through the SelBookmarks collection

3. On each loop, set the cloned recordset's Bookmark property to that of the current SelBookMarks:

rsClone.Bookmark = DataGrid1.SelBookmarks(i)

4. Now use the fields collection of the cloned recordset to get your values:

x = RsClone.Fields(DataGrid1.Columns(0).DataField).Value
or just
x = RsClone.Fields("TheFieldName").Value
 
CCLINT ...
Thanks .. i will try that now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top