I think this may be what you are looking for:
Also, your first procedure probably doesn’t do what you think. You can’t use closewindow to close a secret window – that is actually going to close whatever the topmost visible window is. Probably best to forget about secret windows and just use setactivedatabase. It’s actually the same thing as far as how it works internally, but I think clearer to understand.
Also note that if you want to open a form in a secret database, you can now do so with openform, without having to use a secret window or the setactivedatabase statement. Here’s how you would do that with your secret “Customers” database.
openform "form name","database","Customers"
To open the data sheet, use the code Gary provided.