Master Detail New Record Problem
Posted: Fri 25 Mar 2022 07:26
Hello,
i have,
Master Table :
Table Scales with Fields : ID, IDVehicle, IDCustomer, Weight
Secondary Lookup Tables :
Table Vehicles with Fields : ID, LisencePlate
Table VehicleCustomers with Fields : ID, IDVehicle, IDCustomer
I have connected as master detail connection :
VehicleCustomers.MasterSource := dsScales <- DataSource for Table Scales
VehicleCustomers.MasterFields := Scales.IDVehicle
VehicleCustomers.DetailFields := VehicleCustomers.IDVehicle
Vehicle Table is connected to a LookupComboBox to display all vehicles with field IDVehicle from Table Scales
VehicleCustomers Table is connected to a LookupComboBox to display all customers that belongs to this Vehicle with field IDCustomer from Table Scales
User selects a Vehicle from the LookupComboBox and the VehicleCustomers LookupComboBox should list all customers that belong to the selected Vehicle.
When EDITING the Scales record its working as expected.
When INSERTING a new record on Scales, Vehicle LookupComboBox is selecting vehicles but the VehicleCustomers LookupComboBox stays blank, like the releation is not working.
Note that field Scales->IDVehilce on Vehicle LookupComboBox, is changing value when selecting a Vehicle.
I know that the Master ID Field of Master Table Scales is Null, but the Master Table is not connected with a Detail Table (like master->id=detail->id), the connection is only made for the LookupComboBoxes.
Temp solution :
When setting a temp value to Scales Master ID = 0 and temporaly post the record (not commit), then the releation connection is working fine and
the VehicleCustomers LookupComboBox lists all customers that bellongs to this Vehicle.
Any ideas
Thanks
John
i have,
Master Table :
Table Scales with Fields : ID, IDVehicle, IDCustomer, Weight
Secondary Lookup Tables :
Table Vehicles with Fields : ID, LisencePlate
Table VehicleCustomers with Fields : ID, IDVehicle, IDCustomer
I have connected as master detail connection :
VehicleCustomers.MasterSource := dsScales <- DataSource for Table Scales
VehicleCustomers.MasterFields := Scales.IDVehicle
VehicleCustomers.DetailFields := VehicleCustomers.IDVehicle
Vehicle Table is connected to a LookupComboBox to display all vehicles with field IDVehicle from Table Scales
VehicleCustomers Table is connected to a LookupComboBox to display all customers that belongs to this Vehicle with field IDCustomer from Table Scales
User selects a Vehicle from the LookupComboBox and the VehicleCustomers LookupComboBox should list all customers that belong to the selected Vehicle.
When EDITING the Scales record its working as expected.
When INSERTING a new record on Scales, Vehicle LookupComboBox is selecting vehicles but the VehicleCustomers LookupComboBox stays blank, like the releation is not working.
Note that field Scales->IDVehilce on Vehicle LookupComboBox, is changing value when selecting a Vehicle.
I know that the Master ID Field of Master Table Scales is Null, but the Master Table is not connected with a Detail Table (like master->id=detail->id), the connection is only made for the LookupComboBoxes.
Temp solution :
When setting a temp value to Scales Master ID = 0 and temporaly post the record (not commit), then the releation connection is working fine and
the VehicleCustomers LookupComboBox lists all customers that bellongs to this Vehicle.
Any ideas
Thanks
John