Rather than a button that uses VB to insert records, I would suggest that your accident form has subforms that are bound to the tables to automatically insert the records.
Yours tables may look like this:
Asset table – includes information about the assets. Combo boxes are bound to this tables for valid asset selection.
Harm table – includes all the harm that can be done to any asset. Combo boxes are bound to this table for valid harm selection.
Accident table – identifes the accident
AccidentAsset table – identifies the asset or assets that were harmed in the accident. With primary keys on Accident and Asset codes
AccidentAssetHarm table – identifies the harm caused to each asset in the accident with primary keys on Accident, Asset and Harm codes.
In the Accident form which is bound to the Accident table, a subform would be bound to the AccidentAsset table with parent/child link on the Accident code. Then, another subform inside of the AccidentAsset subform bound to the AccidentAssetHarm table with parent/child link on Accident and Asset fields.
With these forms bound to the tables, the insert of the records will be automatic. No VB code needed.
Discuss This Question: