Updating grand child when saving parent (RegisterForeignKey)


Author
Message
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi All,

I am having problem updating a grand child record when saving the parent.  I attached a small VB sample project using the SF Sample tables Customers, Orders and OrderItems.

I created the main form frmCustomers which is used to add Customer, then the orders are added via a ChildFormDialog frmOrders and the OrderItems are added programmatically, and here is the problem, when clicking the Save button in frmCustomers, the Customers and Orders records are saved and the or_Cust_PK is updated properly, but the record for OrderItems is not saved and I believe the problem is that the field orit_or_pk is not being updated with its parent field value.

To test do the following:

  1. Add a new record in frmCustomers form (I added default values for all adding)
  2. Add a new Order from the Order's listview toolbar.
  3. Add a new Order Item from the frmOrders form.  (This will add a record programmatically with a orit_Prod_PK = 235)
  4. Click OK in frmOrders form.
  5. Click the Save button in the frmCustomers toolbar.
  6. In the Orders listview, Edit the Test PO record.
  7. Notice that there is no Order Item record created, and I have not been able to find out why.

Notice that all I am trying to do here is to implement the logic of saving all BOs in at a single point, in this case the frmCustomers form's Save button.

Edhy Rijo

Reply
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Dustin,

Thanks for taking the time to review the sample project.  I will review your post in detail and make the changes in the sample project before changing my project.

I have not used the FillMultipleDataTable, and guess it is now time to start using it.  In my project I use a Browse Dialog in the main form, but due to time to create the sample project I when the easiest way by just selecting TOP 100.  From my quick review, I noticed the main cause was the filtering of the order item table, which after you explained it, makes perfect sense.

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search