Steve Gray has written a useful post about Making A Custom Field Required using VBA code. He has written code for the Save Button Click event as well as for the dialog box that appears while closing the window
Visit link:
Making A Custom Field Required using VBA