You can improve on this first attempt by making each of the forms more self contained. One way to do this would be add a "Save" and "Quit" pushbutton to each form. Here is how the second cut at the application might look:
|
The above iteration is slightly better. The information is correctly saved to the database when the user selects the "Save" pushbutton. The forms are more self-contained. Operations from "main line" code are being removed and attached to pushbuttons. There is still the asymmetrical behavior when Esc or F10 is pressed. However, another problem has been introduced. The user can press F10 to exit the form, but the data will not be written to the database.