![]() |
|
#1
|
|||
|
|||
|
I have a dbgrid attached to a table. There are 5 fields on the grid. When I insert a new record in the grid, and input the number '370' into the first field, I want to trap the event moving into the next column, so I can automatically insert 2 values into 2 of the other columns.
How can I achieve this? Thanks! |
|
#2
|
|||
|
|||
|
Maybe you can try using your DBGrid's OnColExit() (or OnColEnter()) event :
procedure DBGrid1ColExit(Sender: TObject); begin if ((Sender as TDBGrid).DataSource.DataSet.FieldByName('Field1'). asString = '370') then begin ((Sender as TDBGrid).DataSource.DataSet.FieldByName('Field2'). asString := 'Val2'; [...] end; end; LörAn. ICQ #112714184 |
|
#3
|
|||
|
|||
|
Just a precision :
maybe you'll have to call the (Sender as TDBGrid).DataSource.DataSet.Edit() procedure before changing the other columns values. But I think you have already noticed that... ![]() LörAn. ICQ #112714184 |
![]() |
| Thread Tools | |
| Display Modes | |
|
|