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

Database Index and sorting records

Status
Not open for further replies.

badscots

Programmer
Dec 23, 2003
19
GB
Hello all,

I have a DBC with two tables, TableA Parent and TableB Child in the dataenvironment on a form. TableA has a primary Index set for the relationship with TableB. I have dragged TableB onto the form to create a grid. TableA's selections are in a ComboBox which when clicked will change the records in the grid (all fine at this point).

The point im stuck at is...i want to be able to let the user sort the grid on a chosen field. I have created other index's on TableB but when I choose them the data disappears from the grid.

Is there a way to maintain the relationship with the parent but to also have the option to sort the resulting data on specific fields???

Tx's in advance,

Mac.
 
Mac,

One way to do that would be to delete the relationship within the data environment, and to filter the child table instead. You would filter it so that only child records whose foreign key matched the parent's primary key would be visible.

Then, you should be able to ahead and change the sort order in the column headers without losing the filter. However, I don't know how that would affect performance. You would have to check that for yourself.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hello Mike,

Thanks for your advice, I was so close with the details you mentioned and tried using everything else and forgot about the SET FILTER!!!

Many thanks, works a treat now!

Mac.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top