I have a form with a subform. a primary key(not auto number) field in the subform. if i insert a number in the primary key field. then i delete the number and want to close the main form by clcking x button without saving any record. then the msg "a primary key cannot contain a null value" then a msaccess standard msg. but what i want is My custom msg and not any standard msg