Adding detail record in dbGrid


Well-known member
Oct 21, 2004
Programming Experience
I am using SQL Data Adapters and select statements based on Part ID.
My master record has Part ID and Operation Number as key fields.
My detail record has Part ID, Operation Number and Character Number as key fields.

I need to set up a master detail form with two Grids. I want to be able to add records to the Detail Grid (by moving to the empty row at the bottom) and have the Part Id and Operation Number appear automatically in the grid (depending on which Master Operation Number is selected) when a Character Number is added.

My question is when do you assign values to these fields? Is there an (on add row) or (on new Row) function to attach code assigning values?
Is there a default value setting that I can set to another grids columns?
I have added records using SQLInsert and Table.Rows.Add methods but the action was always triggered by a button not by moving down to an empty row of the grid.

Also, when I move to a different row, I want to update the dataset to avoid hitting a save button after everty new record is added.

The user will be adding hundreds of records in a single sitting and anything I can do to add default values to the detail record would be a great timesaver.

thanks for looking,