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

Navigating with parent/child flexgrids

Status
Not open for further replies.

dlpastel

Programmer
Joined
Aug 8, 2002
Messages
114
Location
US
I have 2 recordsets. One called customers (the parent), the other called invoices.(the child)
I want to be able to move my keyboard up and down arrows or click the mouse on a particular row of the parent and have the child move to that row.

For example if I had 2 customers in the parent flex grid, when the current row is "Smith" I would like to see all invoices for Smith in the child grid and then if I move my down arrow on the keyboard to move the customer to "Jones" then I would like to see the invoices for Jones on the child grid.

I have managed to do most of this with the following code:
rsSearch.Open "SHAPE {select LastName,FirstName,HomeTel, from Customers where LastName = """+txtsearch.text+""" order by LastName} AS ParentCMD APPEND ({select ,CustId,datein,EmpId,jobnum,Notes,status,Store from Invoices Order by CustId } AS ChildCMD RELATE CustId TO CustId) AS ChildCMD", dbCTS, adOpenStatic, adLockOptimistic
Set fMainForm.grdSrchCust.DataSource = rsSearch
Set fMainForm.grdSrchInvoices.DataSource = rsSearch("ChildCMD").UnderlyingValue

The code above displays the customer record in the customer flexgrid and his invoices in the child grid but I do not know how to move up and down in the customer recordset. I can use move.next or moveprevious and that works but I thought that clicking on a row would do that? Do I have to add code to have it respond to clicking on a row or to have it respond to a keyboard up or down arrow? If so, which event should I put it in?
Hope this is clear.

Thanks,
Dan
 
I figured it out. Actually it was easy. Just put code in the grids keydown event to move the recordset move.next or move.previous.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top