Error using master/detail relationship? 
Author Message
 Error using master/detail relationship?

I am having a problem with a master/detail relationship that I can't
get resolved. Any help would be greatly appreciated. Also, please
bear with me while I provide information relevant to my problem.

I have a DB application with 3-4 "master" tables and one "detail"
table. In the detail table there are two fields containing pointers
back to a couple of the master tables. One field is a Shipper_ID
and the other is a Customer_ID. Again, these fields point back to
two separate tables.

I am using a couple of DBGrids to effectively display the detail
information. The master DBGrid shows Customers and the detail
DBGrid shows the detail information by Customer. I have
successfully established the master/detail relationship between
the Customer and detail table. The link on the detail side uses
a secondary index.

In addition, I have defined a couple of lookup fields in the fields
editor for the detail table to actually show the customer name
and the shipper name in the detail grid. This works OK too.

I don't want to allow the user to edit within the detail grid so I
have created "New", "Edit" and "Delete" buttons that will
present another screen to the user for data input. This is consistent
with my approach for data entry into the master tables.

My problem is that behind each "New" button, I am using the
Append method of the corresponding table to add a new record
and put the table into insert mode before presenting the data entry
screen to the user. Every one works ok, EXCEPT for the detail

I am getting a database error stating that my detail table is "not in
insert or edit mode" when I call the Append method. The TTable is
Active and the CanModify property of the detail TTable is True
immediately prior to the call to the Append method. Stranger yet
is that a blank record is actually appended to the detail table. Due
to the DB error however, the never gets executed.

If I unlink the customer and detail tables and execute the same
append/form show sequence, I get no error and my input form
pops up ready to accept input. I would really like to force data
input "by customer" so I can't use the unlinked approach.

Can anyone show me what I am doing wrong? I appreciate the
help. Thanks in advance.


Tue, 26 Jan 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Q: Master-Detail relationship using DBase records

2. Different detail Index order within master-detail relationship

3. MASTER/DETAIL relationship

4. Master/detail table relationship problems

5. Auto Increment Fields and Master Details Relationship

6. Master-Detail Relationship problem

7. DBGrid master/detail relationship?

8. Master-detail Relationship

9. Master/Detail relationship problem

10. why wont this master/detail relationship work?

11. Delphi 2.0 -> 3.0 Master Detailed Relationships

12. Master-Detail Relationship


Powered by phpBB® Forum Software