Newbie - updating Detail in master-detail 
Author Message
 Newbie - updating Detail in master-detail

I'm new to delphi and programming in general.  My question is probably very
basic but I haven't been able to find the answer.  I have 3 tables:

1.  CatergoryTbl - Indexed Category field
2.  BooksNameTbl - Indexed Category & Name fields
3.  BooksInfoTbl - Indexed Category, Name & Information fields

The field are linked in Delphi 3 as follows:

1.  Category is Master Source for BooksNameTbl by Category field
2.  BooksNameTbl is Master Source for BooksInfoTbl by Category &
     Name fields

When the Name is changed in the BooksNameTbl, it does not automatically
change the Name in the BooksInfoTbl, leaving several orphans.  I have tried
to do it by Query but I can't figure out how to reference the
BooksNameTbl.Name field before the Name was changed and I'm not all that
experienced with queries.

What is the best way to accomplish what I want?  Could you please be
specific since I'm still trying to grasp all the syntax involved with using


Mon, 14 May 2001 03:00:00 GMT  
 Newbie - updating Detail in master-detail
Hi Peggy,

If you want access the previous value of any dataset field you can do that with
This will get you the value of the changed field BEFORE it is posted/updated in
the database.  After it is posted then the OldValue variant is updated too.

Another way you may want to solve this problem is to loop through your detail
datasets to change the value that was changed in the master (in the on change
event of the Tfield of the dataset (a Tfield is something that is set in the
Fields Editor of the dataset accessed by double clicking on the Dataset
component and then right clicking to add the fields.  Once you have the fields
in the Fields editor you can click on any field and view the object inspector
for events for that TField.  One of them is the OnChange event) , something
like this:

Query2.FieldByName('YourColumnName').AsString :=
Until Query2.Eof;

Hope that helps.  If you need more help just ask.  Happy Thanksgiving!

Michael Glatz

Mon, 14 May 2001 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Master-Detail : Sorting Detail?

2. Master - Detail - Detail queries & DBGrids

3. Setting report variables in the detail of a ReportSmith master-detail report

4. Master-detail-detail-detial with Cascade delete

5. Master/Detail lookup - losing detail field

6. HELP: Master-detail form: sequence of detail records

7. Sorting detail records in a master detail relation.

8. Problem when inserting records in the detail table (master/detail relation)

9. Different detail Index order within master-detail relationship

10. Master->Detail->Detail Query Too Slow

11. Help with Master/Detail file deletes (newbie)

12. Deleting from Master/Detail using cached updates


Powered by phpBB® Forum Software