Take a look at the Re-Login script step--you can look it up in help. This step would seem made to order for what you want to do. Something like:
Set Error Capture [on]
If [ Not Get ( LastError ) ]
Go to Layout
A more sophisticated script can do this in a loop and you can check the actual error code returned to distinguish between the user clicking cancel and incorrect credentials. Also, you can add code inside the if step that checks account or privilege set names to determine if the credentials used are those that allow access to the other layout.
And it would be a good added layer of security if you use Manage | Security to limit access to this other layout to only accounts with certain privilege sets. That way, if the user finds a way to get to that layout in spite of your interface design, they get a grey screen that read "no access" instead of seeing the actual layout.
Thanks. I tried this, but if you hit cancel after the script starts to run, it takes you to the "manager" layout which is the one I want to use for the correct password. How do I get it to default to the original layout? TIA
That should not be the case. When you click "Cancel" in the password dialog, a nonzero error code is returned--the value 1. (You can look up error codes in FileMaker Help.)
Not Get ( lastError ) will evaluate as False and thus will not result in a change in layouts as only a zero error code result will allow the script to change layouts.
So you'll need to take a closer look at your script to figure out why that didn't happen when you clicked "Cancel".
Thanks, I had the layouts in the incorrect order. That worked!