I have set up a simple form with a parent child relationship. It has the usual thing with textfields linking to parent data and a grid linking to the child records. The test database is just a parent table with 3 records (firstname, lastname, pkid) and child (firstname, lastname, pkid, childNo). The parentBizobj's key field is pkid. The chidNo field is indexed as a foreign key to the parent pkid. The childBizobj has its keyfield set to pkid and self.LinkField = "ChildNo". Four buttons handle first, prior, next and last navigation in the parent. This works perfectly as the grid always updates correctly when navigation occurs in the parent table. Three other buttons are supposed to handle new, save and cancel functions. When I click New (code: self.Form.new() or self.Form.new('parent'), I lose the link to the grid. I can still navigate the parent, but the link to the child records are lost. The traceback is lengthy and not too helpful, but the gist of it seems to be that the grid loses its current row number and I see such things as "uiIndex < m_nCount failed in wxBaseArray" blah, blah. Obviously the grid has lost its link to the parent.
Without bogging you down with all the details, is there usually a common error beginners make when having problems adding a record to a parent table linked to a child? I must be doing something right if I can navigate OK but somehow I am missing something basic about adding a record to a parent.
BTW, new() works fine in a simple form with only one table.
Steve Rose
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
©2007 Steve Rose |