PanX can't open a secret database in visible form

In Pan 6, it is possible to use opensecret to open a file and then to use openfile to make it visible. Pan X doesn’t allow this, either manually or programmatically. It really should allow this.

I hesitate to record this in BitBucket in case it’s one of a feature, unavoidable or already reported.

You are a correct. I’ve added it to BitBucket.

However, the title of your post isn’t really correct. You can make a secret database visible, but only by opening a specific view. For example, suppose the database is named secretdb. You could make the data sheet visible like this:

setactivedatabase "secretdb"

Or make a specific form visible.

setactivedatabase "secretdb"
openform "my favorite form"

BTW, if anyone reading this is not familar with setactivedatabase, it is exactly the same as

window "secretdb:SECRET"

Hold the presses! Ok, I just realized, there is a way to open whatever the saved windows were –

setactivedatabase "secretdb"

Still, it’s correct that openfile did this in Panorama 6 and should be changed.

This isn’t working for me. I have a database that is open Secret, and I’m trying to use this code (from another database) to open a form in the “secret” database.

setactivedatabase "UserPreferences"
OpenForm "UserForm"
Find Username=UserMe

It won’t run at all, when I have the procedure window open and try to run it, the bottom of the procedure window has the message: “Cannot run because there is no open data window for this database”. The “check” test shows no errors.

It’s not surprising that there is no open data window for the database I’m trying to access, so I don’t understand what I can do about it.

@staylor246 Your problem has nothing to do with the code. A procedure won’t run if the only open window in the database is the procedure window itself. So to get this to run, you’ll have to open a form or data sheet in the database that contains the code. This would be true even if the code was just a message statement or some other simple code.

Unrelated, there is another way to write your code, without the setactivedatabase statement.

openform "UserForm","Database","UserPreferences"
find Username=UserMe

I do wonder about that last line. Is one of those symbols a global variable?

Well, I’m looking at an open form of the database that contains this procedure while I’m doing this, so that doesn’t seem quite right. Ah, but it is in Graphics mode, and you know the rest. I get tripped up on this a lot at other times and I don’t recall this was ever an issue in Pan 6. Are you locked into this behavior with Apple code, or was it deliberate? It’s tedious in development mode to have to keep switching back and forth between Data and Graphics just to run something else.

Yes, UserMe is a global variable.

Panorama 6 was exactly the same.