Here is the situation I ran into that I thought I would share that may help someone.
The design: I have a table that stores client information including Last_name. I have a grid with the fields Last_name and First_name that is set to display {Last_name}, {First_name} (via Free Form Layout) with the First_name field hidden. The grid is also ordered by Last_name. The Last_name field is a Link Control to populate a detail view for editing.
The dilemma: For clients with the same Last_name the link from the grid to populate the detail view will always bring up the record related to the first occurrence of the Last_name based on recno() order. So if I have 5 Smiths in the database and John Smith was the first Smith entered into the database, all other Smith Links in the grid will populate the detail view with John Smith�s data. So the logic behind the Link Control seems to be to always retrieve the first occurrence of the Link value regardless of the recno() that should be associated with the link in the grid.
Given that I would like the interface of my project to remain the way it is letting a client click on Last_name to populate the detail view but actually get their record and not John Smith�s .
My Solution: (probably one of many)
I had an ID field in the table set to auto increment and is therefore unique. I added this ID field in the grid as a Link Control. I made it the Link to the Detail View and specified that the Link Display be set to the Last_name field instead of ID. I then used the Free Form Layout to populate the grid for the ID field as {ID}, {First_name} while hiding Last_name and First-name fields. This effectively maintained the interface as it looked before and corrected the Link problem.
This is probably how I should have done it to begin with and I am not proposing that anything is wrong with the Link Control. However, this does point out how easy it is to use the Link control improperly. If you are using the Link Control make sure it is only used with a unique field value otherwise you are probably not getting what you intended.
Chuck
The design: I have a table that stores client information including Last_name. I have a grid with the fields Last_name and First_name that is set to display {Last_name}, {First_name} (via Free Form Layout) with the First_name field hidden. The grid is also ordered by Last_name. The Last_name field is a Link Control to populate a detail view for editing.
The dilemma: For clients with the same Last_name the link from the grid to populate the detail view will always bring up the record related to the first occurrence of the Last_name based on recno() order. So if I have 5 Smiths in the database and John Smith was the first Smith entered into the database, all other Smith Links in the grid will populate the detail view with John Smith�s data. So the logic behind the Link Control seems to be to always retrieve the first occurrence of the Link value regardless of the recno() that should be associated with the link in the grid.
Given that I would like the interface of my project to remain the way it is letting a client click on Last_name to populate the detail view but actually get their record and not John Smith�s .
My Solution: (probably one of many)
I had an ID field in the table set to auto increment and is therefore unique. I added this ID field in the grid as a Link Control. I made it the Link to the Detail View and specified that the Link Display be set to the Last_name field instead of ID. I then used the Free Form Layout to populate the grid for the ID field as {ID}, {First_name} while hiding Last_name and First-name fields. This effectively maintained the interface as it looked before and corrected the Link problem.
This is probably how I should have done it to begin with and I am not proposing that anything is wrong with the Link Control. However, this does point out how easy it is to use the Link control improperly. If you are using the Link Control make sure it is only used with a unique field value otherwise you are probably not getting what you intended.
Chuck
Comment