This question has been asked before and I tried searching for an answer for this but could not find much!
I have a Main form to create Employees with EmployeeID as the PK. The EmployeeID is generated in the BeforeUpdate event after all validation is complete.
I also have a Subform to create a number of Roles for the Employee, so 1 to many relationship.
I want to prevent creation of Mainform record until at least 1 Roles record is created.
I tried adding code in the mainform AfterInsert event to read the Roles table to check for an entry for the new Employee record created (with newly generated EmployeeID). If not found then display message. This kind of OK but the mainform record is already saved. What I need is an event so that before the final mainform save (i.e. moving to next or before record) it will check record existence in the Roles table and prevent mainform update until at least 1 Roles record is created.
Any suggestion please?