I had two windows open of my database. I closed one showing all records without saving (CMD + W). I was left with the second window showing the procedure below, which I saved (CMD + S) prior to closing.
Now when open the database it appears to contain just this window (note the error message at the bottom when trying to run it).
When I try to restore a previous version, it does not let me.
What is the solution? Re-importing records it not a big deal but it would be a great loss forfeiting all the programming I had done.
I have a Time Machine backup but I would like to know if there is a better answer.