This sounds like an issue I had with a "PhoneMessages" widgit that I set up so employees could take down phone messages and route them to appropriate recipients. I gave them two message formats: "Message" and "Memo" where Message uses most of the screen layout for formatted check box fields and the like to quickly take down standard type messages and "mem" displays a single large text field over most of the layout.
I use a script trigger, OnRecordLoad to perform a script that selects the appropriate layout for the new current record.
To set a trigger for a layout, go to the Script Trigger tab in Layout setup...
Be careful with all layout based triggers. Other scripts in your DB that interact with this layout will likely activate this trigger also--with possibly unexpected results.
Though I don't see the reason for the Adjust window and enter Browse mode steps, Your script, as written, could be linked to this script trigger.
Thanks. I'll keep those instructions when I upgrade to FMP 10, do you have a solution of FMP 9 though??? Also, I used Adust Window because the Layout is very large and depending on what layout was used previously sometimes it shows much smaller than wanted. I use Browse mode so they can navigate to the many tabs that are on the layout.
Pre FMP 10, I've used this approach.
Hide and lock the task bar so that the "book" control for clicking through records is not available.
Create your own button bar with tool bar functions across the top of your screen to put back any tool bar functions you want to make available. Since these are buttons you've created, you can attach scripts that also control what layout is displayed after they move to a different record, find records, etc.
With FMP 9 advanced, you may have a better approach in that you can design custom menus where you replace each menu option that could switch you to a different record with a script that performs the same action then selects the script that selects the appropriate layout.
As a final security measure, I'd use accounts and privileges settings to set things up so that if the user finds a way around all the above tricks, all they see is "<<access denied>>" if they get to the wrong layout for the current record.
In response to Enter Browse Mode and Adjust Window:
Since you have to be in browse mode to move from record to record, I assumed that you would be in browse mode every time you performed that script. It's harmless, but appears unecessary. I was checking in case there was something unsual going on there.
Likewise, since both layouts can be displayed in the same window and switching from one layout to the other won't change the current window size, adjust window would seem unecesary.
Thank you. This is a great solution!!