Instability and bizarre behaviour in a database set that was previously working well

I have a set of databases that I use for my financial records. When I last opened it 2 months ago it was working very smoothly. I’ve now opened it to do this quarter’s financials, and there is all sort of bizarre behaviour occurring. Lots of crashes. Selecting records in a table doesn’t work, it jumps randomly to another record - can only stay on the record I choose by going to the data window (this is behaviour I have seen in another of my databases, but not in this one). Subroutines are only processing every 2nd record… I guess there’s some sort of corruption occurred somewhere. I’m wondering if there’s a simple trick to ‘reset’ the database somehow (like duplicating and renaming, or something) that might fix the problem??

Do you have multiple list views open? For example the data sheet and a view-as-list view? Or the data sheet and a form with a List object or Matrix object? Some of the symptoms you are describing would occur in that scenario. It’s best to have only one window open at a time that displays multiple records. You can have multiple form windows open as long as they are each showing just the current record. I think if you close the additional windows many of your problems may go away. Don’t know about the crashes though. Our records do show 6 crashes reported from you in the last 24 hours. All six crashes appear to be identical. Unfortunately, the crash report doesn’t make any sense to me, and I don’t see any other reports with the same crash signature from any other computers.

Oh my goodness. Not only did that fix the problem - but procedures run about 100x faster!!

So I struggle to manage the windows in my databases. Especially when I have to move between databases. The goform statement is perfect for moving between windows in a database because it closes the present window and opens the next. I do use it to move between databases even though the documentation doesn’t seem to indicate that this will work (!). However, in my most complicated database, it doesn’t then function properly if I only have one window open in each database - with the programme becoming confused about which database the window relates to (a form from database A will show the number of records in database B, and fields that do not exist in database B that should be displayed will show error messages saying than database A is not open). I think this is because when the last window of the database is ‘closed’ by the goform statement, the database sort of closes, even though it doesn’t… So my question is - how do you recommend moving back and forth between databases, and managing it in a way that doesn’t leave forms open, so that I end up with multiple forms? Maybe I need to discipline myself to have an ‘entry and departure lounge’ form, even its a blank form with no data display??

I suspect that trying to change databases by using the Goform statement is a source of problems. But there is no doubt that you can switch to another database and open a form with a procedure. In database A, in a procedure, you can do use setactivedatabase [Second Database Name], followed by an openform [Formname] statement to open a form in the second database (assuming the second database is already open). That will change databases and open a form in the second databases leaving the original database and its windows unaffected. If you already have databases with windows in both databases, you can use the window statement to switch to a window in a different database. The help page on Window statement has some useful info.

The goform statement does not have any option to specify a database, so there is no way you can use it to move between databases as you have described.

Ok, I just double checked the source code, and it looks like I did start implementing a database option for this statement. But it was never finished, I think probably because I couldn’t figure out any way to handle the edge cases you are describing. So do not use this undocumented behavior! In fact, now that you’ve brought this to my attention, I will probably completely remove this partially implemented code, so consider this a warning to remove this from your code asap.

There is no way to do this.

!!!

Could you suggest a subroutine to close all windows except the active (top) window, that I could use when i move back to a database?

You’ll find a similar code sample in the documentation of the listwindownumbers( function.

Number one thing to do is turn on “Always keep database open…” in the Database Options panel for all the files that are used. I am assuming here that you have a starting database that opens to a desired window and then opens the remaining databases secretly. You could set the Initial Window option for this startup db in the Database Options panel as well.

Now you can have a procedure for each file that basically gets the current window rectangle, closes the form and then opens another form from another database at the same size and position. Here is an example that you could use and adjust for the form and database you want to navigate to.

let startRectangle=info("windowrectangle")
closewindow
openform "Report","Database","Members","Rectangle",startRectangle

So the only thing that needs to changed is the form name and database name for each instance. Make sure after changing the Database Options that you save each database so they take effect.

One thing I notice with this setting is that you can not close these files and they remain in memory until Panorama quits. Choosing Close Database from the File menu only closes the currently open form but does not close the file. I don’t know how you could close these databases and clear them from memory other than going into the Database Options panel and undoing that setting, saving and then closing. May not be a problem in all cases but worth mentioning.,

Thanks everyone for these suggestions.

I think the best way to achieve what I want will be to move between databases with “setactivedatabase,” and then “goform…”, rather than moving directly between databases using “openform…”. (Now that I see it written down, its so blindingly simple none of you could probably conceptualise that I wasn’t doing this!)

I think I will nonetheless play around with a subroutine like Kurt has suggested, probably on opening my databases, to get rid of any extra windows that may have stayed open during a previous session, to keep everything neat and operating smoothly.

You can use the closefile statement to actually close the database and remove it from memory. The Always keep database open statement prevents the database from closing due to normal user interface operation (clicking the close box, choosing close in the File menu), but you can still explicitly close the file using a procedure.

I have set about removing the offending code as you recommend - and it has unmasked the reason I ended up using the “offending code”, which is that Panorama becomes confused about which database is attached to the form - see “Forms confusing databases” which I posted previously. I was able to minimise this happening by specifying the database after the goform statement.

So here

setactivedatabase "Cattle Database-Active 3"
goform  "SearchList"

has brought up the appropriate form, but not really changed the active database. You can see this, because the previously active database has 6192 records, and the “Cattle Database-Active 3” only has 773. Furthermore, if I now try to do something in this window, I receive an error message

because it is not in the correct database.

This (at long last) seems completely reproducible. I have gone in and out a couple of times, and it seems to consistently do the same thing - if you would like to have a look to see what is happening. Again, if I change the code to:

setactivedatabase "Cattle Database 3"
goform "ActiveAnimals","database","Cattle Database 3"

it rectifies the problem.

or not always - at the moment I’m completely broken :sob:

I use this to move from an active database to a secret database:
openform “Data Entry”,“database”,“mysecretdb”

Replace “Data Entry” with the name of the form in your secret database and “mysecretdb” with the name of your secret database.

To go back to the original database and make the current one secret again, do this:
makesecret
openform “Work”,“database”,“my originaldb”

Again, Replace “Work” with the name of the form in your original database and “originaldb” with the name of your original database.

If the original database was not secret, you can also use:
Openfile “originaldb”

I think the problem here, is that you are using goform, instead of openform. Goform puts the form in the existing window, but the existing window, in this case, doesn’t belong to the database that contains the form you are switching to.

That explains perfectly why it is happening. The reason I was trying to do it this way is that I am trying not to have extra windows open. In the past, if I only had one window open, and closed it to move to a window in another database, the database closed, and wouldn’t open again. Now that I have the option of setting the database preferences to stay open, this problem seems to be resolved, and I can go back to simply closing and opening!

Fingers crossed.
Many thanks.

I think this is a bug. The bug is not that it doesn’t work, but that it doesn’t cause an error. The goform statement cannot be used to flip between databases, and it should produce an error if you try to do that.

I haven’t read every bit of this thread so it may have been mentioned already, but there is a new option in Database Options that does just that. Under Initial Windows you can select the window(s) that are to open when the database is opened. Nothing gets ‘left over’ from a previous session.

Well the part that you did read you read well, I missed that detail. Now that you’ve brought it to my attention, I’ll post the help page for this feature.