Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script won't run on file closure

Featured Replies

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

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?

  • Author

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,

There was nothing in the script you posted that tells it to not close the file.

  • Author

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.

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.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.