Sorry if the question seems vague, please let me explain.
I have two datasets, called, say, Master and Extensions. They have a same primary key, but not all Master records have an Extensions record (this is the important point).
The UI are the usual data aware controls linked by datasources, placed in a TPageControl, with a page/tab for each dataset. A TDBNavigator linked to the Master dataset allows the user to browse through the records.
The user could be on the Extensions page/tab while browsing, and may want to edit the Extensions record data. If an Extension record already exists, all's well and good because the AutoEdit property of the datasource will automatically place the dataset into edit mode.
But what if there is no Extensions record? I suppose I need the equivalent of an 'AutoInsert' property, that would automatically place the dataset in Insert mode if the user starts to typing in one of the controls. (and I can always set up the primary key in the BeforeInsert event).
Any thoughts how I would achieve this?
Thanks for any advice, and thanks for reading a long question,
I would programmatically insert the record when the user enters any of the editable controls, and remove it afterwards if it's not needed. You should be able to do that without hitting the database at all, so the only real cost is a little code.
I don't think it's really autoinsert when you're inserting a new row into the middle of a sparse table like this.