Hi,
I have a master & 5 details tables. The Detail tables have MasterSource, MasterFields, DetailFields set. When I browse the master, the cursors on the details follow just fine.
When I do a Table.Insert though, an entry is only inserted into the master, any OnNewRecord is is only called for the Master.
Why? Should the INSERT of the detail tables not be automatic?
Thanks in advance,
Sean Boran
Master-detail - INSERT
I also wished to add, that I do
ShowMessage('Insert');
dmJOB.taJOBCARD.Insert;
ShowMessage('post');
dmJOB.taJOBCARD.Post;
but that I don't see the INSERT in the DBmonitor, nor is a row inserted into the master table (taJOBCARD)
In dmJOB.taJOBCARDNewRecord I have
with DataSet do begin
FieldByName('jcard_no').value:=current_job;
ShowMessage('taJOBCARDNewRecord ' +FieldByName('jcard_no').AsString);
end;
And I do see the ShowMessage with the currect value for the Index.
What am I doing wrong?
Sean
ShowMessage('Insert');
dmJOB.taJOBCARD.Insert;
ShowMessage('post');
dmJOB.taJOBCARD.Post;
but that I don't see the INSERT in the DBmonitor, nor is a row inserted into the master table (taJOBCARD)
In dmJOB.taJOBCARDNewRecord I have
with DataSet do begin
FieldByName('jcard_no').value:=current_job;
ShowMessage('taJOBCARDNewRecord ' +FieldByName('jcard_no').AsString);
end;
And I do see the ShowMessage with the currect value for the Index.
What am I doing wrong?
Sean
> Yes, according to Master-Detail ideology insertion a record in Master is a little related with insertion a record in Detail. For Detail you also need to execute Insert..Post manually.
Hmm. And to set the value of the primary index after insert, I should be able to do it in the OnNewRecord event? Because in the example I list, the new row is NOT posted to the master (leaving aside the detail tables).
with DataSet do begin
FieldByName('jcard_no').value:=current_job;
ShowMessage('taJOBCARDNewRecord ' +FieldByName('jcard_no').AsString);
end;
I get the showmessage, but no row appears in the table.
Hmm. And to set the value of the primary index after insert, I should be able to do it in the OnNewRecord event? Because in the example I list, the new row is NOT posted to the master (leaving aside the detail tables).
with DataSet do begin
FieldByName('jcard_no').value:=current_job;
ShowMessage('taJOBCARDNewRecord ' +FieldByName('jcard_no').AsString);
end;
I get the showmessage, but no row appears in the table.