John Chamberlain Posted March 14, 2010 Posted March 14, 2010 I have the following script: Set Error Capture [On] Perform Find [Restore] If [Get (FoundCount) = 0] Exit Script [ ] End If If [isValid(Contact_Data::DupWarning_Address) or IsValid(Contact_Data::DupWarning_ID) or IsValid(Contact_Data::DupWarning_Name) or IsValid (Contact_Data::Incomplete_Record_Warning) Go to Layout ["Volunteer Information Sheet" (Contact_Data) Enter Browse Mode [ ] End If I have set the script, using File Options, to run when the file is opened and when it is closed. It runs fine when the file is opened, but it will not run when the file is closed. Anybody know why? TIA
IdealData Posted March 15, 2010 Posted March 15, 2010 Is the script not running or only running part way? Test by putting pauses after each line so you can see what's going off. What purpose does this serve on closure?
John Chamberlain Posted March 15, 2010 Author Posted March 15, 2010 The reason I want it to run at shutdown is to alert the users to eliminate any duplicate records they may have entered BEFORE they exit the program. As I said before, the script does run as intended when the file is opened. but not when the file is closed. I want it both ways to totally insure the a user knows there is an erroneous record. Putting Pause before the last step works so I guess I will leave it at that. Thanks,
Fitch Posted March 15, 2010 Posted March 15, 2010 There was nothing in the script you posted that tells it to not close the file.
John Chamberlain Posted March 15, 2010 Author Posted March 15, 2010 I guess I thought the If [Get (FoundCount) = 0] Exit Script [ ] would do that if no dups were found, and that if they were the succeeding steps would cause it to enter Browse mode, thus ending the script. Anyway, putting a Pause step just before the last End If makes it work the way I want it to. Thanks for your interest.
Vaughan Posted March 15, 2010 Posted March 15, 2010 If you want to stop the window from closing you'll need to use custom menus and trap the Close command. The reason I want it to run at shutdown is to alert the users to eliminate any duplicate records they may have entered BEFORE they exit the program. Note that in FMP 9 and earlier you cannot stop the window form closing if the user exits the program, only if they close the window. With FMP 10 and later you can stop the program from exiting: set the script result to "false" and run it as a closing script.
Recommended Posts
This topic is 5367 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now