Hi! Can anybody help please?
I have a form frmCompany and a subform fsubCompanyRole in an ms access front end. They are bound by tables tblCompany and tblCompanyRole and linked by lngCompanyId in an ms access backend.
I want to stop users deleting all records from fsubCompanyRole for any given company. The logic being that every company has at least one role, i.e; Customer, supplier etc...
I have tried using the BeforeDelConfirm event and canceling the delete if the number of records in tblCompanyRole is 0 for the given company. This won't work because the records I am deleting are not yet deleted when the event fires so there cannot be 0 records!
I then tried using AfterDelConfirm but the records are gone by the time I can check the number of records and I cannot get them back!!
Does anybody know what the best way of approaching this is?
I have a form frmCompany and a subform fsubCompanyRole in an ms access front end. They are bound by tables tblCompany and tblCompanyRole and linked by lngCompanyId in an ms access backend.
I want to stop users deleting all records from fsubCompanyRole for any given company. The logic being that every company has at least one role, i.e; Customer, supplier etc...
I have tried using the BeforeDelConfirm event and canceling the delete if the number of records in tblCompanyRole is 0 for the given company. This won't work because the records I am deleting are not yet deleted when the event fires so there cannot be 0 records!
I then tried using AfterDelConfirm but the records are gone by the time I can check the number of records and I cannot get them back!!
Does anybody know what the best way of approaching this is?