This is a very useful feature for keeping broadly used procedures in memory or for being able to do lookups, build arrays or whatever.
I found that I can have a procedure simply open and close a database and everything about it remains accessible. I can access the file and open a form just the same as if it’s visibly open already.
I don’t know what the intent or expectation is but that doesn’t seem to work is if it’s opened using OpenSecret, the closing it again.
Advantages of AlwaysKeepOpen after closing the file include the ability to open the file from the Finder and functions like SelectRelated, AddRelatedRecord still work.
This option prevents the user from inadvertently closing the database by closing the last open window. It does not prevent the database from being explicitly closed by procedure code. The user can also explicitly close the database by using File>Close Database (of course you could customize the menu to remove that option if you wanted to). I think if there was no way whatsoever to close a database that would be a bug.
The intent that lead me to this is that I want to programmatically launch a file, then close it again while retains the abilities I noted. This is for files that are primarily full of reference data for other files and seldom accessed by the user.
Using SecretWindows keeps the file from showing as it loads, so I was trying to keep it invisible through the whole process. There are other ways, such as keeping it tiny, but keeping it invisible the whole time would be so much cleaner.
Based on your description, what you want to do is use opensecret to open the database and then leave it open. If you close a database it’s closed. A closed database is just a file sitting on the disk, you can’t access anything in the database (data, procedures, etc.) without first opening the database.
If you use opensecret to open it, it will be invisible unless the code explicitly opens a form or the data sheet.
Not that what you want to do is essentially the same function as a library database. Library databases have always opened secretly, and have always had the “always keep open” functionality (that is done automatically for library files even if that checkbox isn’t checked). Library databases are always “invisible through the whole process” except when specifically invoked (for example most dialog boxes are actually forms in library databases). You can do the exact same thing by using opensecret and the always keep open option.
The opensecret statement means that whether a database is open or closed is completely uncoupled from whether it has any visible windows. Of course a closed database doesn’t have any visible windows, but a database can be open even though it doesn’t have any windows. When it is in that state, the only way to do anything with it is through code – there is no user interface that allows doing anything with a “secret” database. (The exceptions would be the Memory Usage, Open View, View Search and View Organizer windows, which do allow you to open views that are associated with a database that has no windows.)