I've already done it before, but the result still the same

procedure TForm1.TDetailNewRecord(DataSet: TDataSet);
begin
    With TDetail do
    begin
        FieldValues['TNo']              := TMaster.FieldValues['TNo'];
        FieldByName('TUrut').AsInteger  := RecordCount + 1;
        FieldByName('TQty').AsInteger   := 0;
        FieldByName('THrg').AsInteger   := 0;
        FieldByName('TSubTot').AsInteger:= 0;
    end;
end;

On 2/6/07, Vishak <[EMAIL PROTECTED]> wrote:
> Hi,
> When you define a master-detail relationship between two datasets (tables, in 
> your case), the detail dataset is filtered according to relationship field 
> with master dataset. When you create a new record in detail dataset, please 
> check if you are setting the value of this relation field according to 
> current record in Master dataset.
>
> E.g.
> OnNewRecord of detail u can mention
> TDetail.FindField('TNo').AsString := TMaster.FindField('TNo').AsString;
>
> HTH,
> regards,
> Vishak
> ----------------------------------------------------
> ----- Original Message -----
> From: Alex Oentoro
> To: [email protected]
> Sent: Tuesday, February 06, 2007 9:44 AM
> Subject: [delphi-en] problem about ADOTable+Grid
>
>
> Hi,
> i have a question about master-detail connection using TADOTable & Grid
>
> I put 2 ADOTable in 1 form :
> TMaster : Primary Key : TNo
> TNo char(10)
> TTgl date
> TCust char (25)
>
> TDetail : Primary Key : TNo, TUrut
> TNo char(10)
> TUrut byte
> TBarang char(25)
> THrg integer
> TQty integer
> TSubTot integer
>
> TMaster & TDetail connected via MasterSource property of TDetail
>
> each table connected to separate Grid
>
> the Problem occurs on the detail grid. Everytime I enter more than 1
> row, detail for the previous row become disappear. But after the
> Transaction is saved, all data rows suddenly appear.
> eq : I enter 1 row on detail, and then press down key to enter data
> for 2nd row on the grid ... then 1st row is disappear. Same thing
> happened when I press down once more to enter the 3rd data, so at one
> time there is only 1 row appear in the detail grid
>
> what should I do to make all rows always appear when I enter more than
> 1 row of data ?
>
> thx in advance.

Reply via email to