master/detail for two lookup lists

I have a multi level category field that I need to capture on a form.
I have two tables connected to each other in M/D relationship. Each
table is connected to its own lookup table

Table1 -> Datasource1 -> ldb ookup 1 which serves as the master table
Table2 -> Datasource2 -> dblookup 2 which serves as the detail table

During runtime this works properly the first time I add the record;
i.e. the primary key of the first lookup table is stored in the main
table for the form and the primary key of the second lookup table is
also stored correctly in the main table.

However, if I change the detail category without also changing the
master category, then the change will not take place after I post the
record (using DBNavigator). If I change the master category and change
the detail category, then both changes take place like they should.

I have thought about trying to get the actual value of the detail
category and manually changing the value in the before post event of
the main table, but I don't know how to get that value. It seems I can
get the string of the value but not the key field of the actual detail
table.

Any Ideas on how to fix this or other ways to accomplish the same
thing.