ADO Master/Detail Addnew Update???

ADO Master/Detail Addnew Update???

Post by Mark Twomble » Tue, 17 Oct 2000 04:00:00

Hi I'm having a problem with adding records to a child table with ADO using
VB6 SP4. Here is the scenario

Table A has a one to one relationship with Table B, but Table B doesn't
always relate to a record in Table A (it is normalized.)
Table C and Table D have a many to one relationship with Table B.

Table A is user information.
Fields: Login Name.
Table B is the contact information.
Fields: First Name, Last Name.
Table C is the address.
Fields: Typical address fields.
Table D is the phone numbers.
Fields: Typical phone fields.

I have tried the data environment to create the parent child relationship,
manual recordsets with shape clauses and manual recordsets with select
queries. All of these methods display the data great it breaks down when I
try to add a new record to the child table.

I will drop Login Name, First Name, Last Name as text boxes, address and
phone I will drop as datagrids with addnew, delete, etc set to true.
Using the data environment and manual recordsets with shape clauses I can
change data in an existing record on any field but if in the grid I go to a
new line and type into a field the field blanks when I try to leave it.
I thought I would go back to the old way of doing it in VB5.  I put 3 ADO
data controls onto the form, hooked the fields to the corresponding data
controls.  I would then requery the data in the children when the parent
moved.  The problem with this is that the requery causes the fields to lose
the connection to the data controls.

So the question is what am I missing.  If a sample would help please e-mail
me and I will send it to you.

Thanks in advance for any help you can offer.
Mark Twombley
Diaganos Solutions


1. 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


2. Questions about Unidata on NT

3. Updating master-detail-detail Recordsets problem

4. Problem with DataCombo & SStab

5. Selecting from Master/Detail w/ Detail as columns of Master

6. Contractor Renumeration

7. updating, searching, and filtering master/detail


9. Confirmed D2 bug: cached updates don't work for master/detail - here's why

10. Appling updates for master/detail relationship

11. Master / Detail Relationships with cached updates in Delphi 2.0

12. Master/detail-problems with cahched updates