Problems Opening and Closing a Database

One of my databases has problems opening and closing. Probably 80% of the time, it does not open a window and it does not run the .Initialize procedure. I have use View Organizer to open a window, then run the .Initialize procedure.
It also has trouble closing. It does not respond to a procedure consisting of Save and Closefile. In that state, it also does not close when selecting Close Database Under the File Menu. Sometimes, the window closes but the file stays open with no windows.
Jim, this is the same database that I sent you yesterday, although I have made quite a few changes since then.
All my other databases work normally most of the time, but not 100%; it’s just this one database that is showing this behavior.

I have found that if I close the database with a close file command, then the next time I open it, the problems occur. No windows open and .Initialize does not run.
BUT, if I save the database, and quit Panorama, the database will open correctly once I restart Panorama.

So you are able to duplicate this every single time you close the database with a close file command?

I know this problem exists. I have a database that does this about 1 out of 25 times (it is the database that contains the source for Panorama Help). But I definitely use close file on that database all the time without problems.

One thing I haven’t been able to figure out is whether it isn’t saving the window positions, or if it is not opening the window positions properly. Since this only happens for me very sporadically, I haven’t been able to track that down. If it really is related to the close file command, that would indicate that the problem is that it isn’t being saved properly. So that could be a good clue.

The problems with closing/opening/no window/no .Initialize functions happens very consistently with the attached file. It manifests itself in slightly different ways, but they all seem related.

I have found that quitting Panorama, rather than using a Save Closefile procedure, avoids the problems quite reliably, so that is my new habit. On the attached file, the user would start at the Home screen, from there go to a case and then back to the Home screen. There is Quit button on the Home screen, which executes the save/closefile statements. I think that fails every time.

Tom

Also, I have several files that seem to close and open without a problem using the closefile statement.
Tom

Aha – so you are saying this happens when you run a procedure to close the file. Do you have any idea if it also happens if you manually use Close File from the File menu?

It is difficult to reconstruct the exact sequence causing specific abnormalities, but at times, with certain problem databases, choosing Close Database from the file menu either has no effect or closes the window but leaves the database open. But it also sometimes closes the window and the file. It’s erratic.

Tom

I ran into this same problem and I did a little experimenting. In any database, if I trigger a procedure which contains:

save
closefile

the database will close and cannot be opened again. If I remove the save command, all is well. Similarly, replacing closefile with closewindow is fine, with or without the save command.

So it seems that the combination

save
closefile

is lethal. But saving with CMD-S and closing the file manually is OK.

michael

I agree; using save closefile causes a problem. closefile alone does not. That was a very helpful discovery.
Next I tried inserting some other commands between save and closefile; I put in

save
selectall
Field fieldname sortup
closefile

That also seems to work and avoid the problem. Yippee!

BUT, using the selectall alone, or Field fieldname sortup alone between Save and closefile does NOT avoid the problem. The problem being the next time one opens the database, no windows appear and .Initialize does not run.

Also, inserting closewindow between the save and closefile doesn’t help. Having found that, I stopped looking for alternative inserts.

m

I have fixed this problem with save and closefile.