October 27, 200421 yr I'm trying to script a find command that searches a table to see if a record has already been created and if so tell the user. I've got the script to work, but when the Find finishes, and there are no matches, it keeps putting up a dialog to say that no records have been found. Is there any way I can stop this happening?
October 27, 200421 yr From FM Help: If FileMaker Pro doesn't find any records that match the find criteria when you perform the script, you can stop the script, continue the script with zero records in the current found set, or change the find criteria. By using the Set Error Capture script step and the Get(LastError) function, you can set up a script to handle such situations. For example: The following script tries to perform a find. If no records are found, a custom dialog will appear giving the user the option to modify the find request or go back to Browse mode. Set Error Capture [On] Perform Find [Restore] If [Get (LastError) > 0] Show Custom Dialog ["No records were found. Click OK to modify your request or click Cancel to return to Browse mode."] If [Get (LastMessageChoice) = 1] Modify Last Find Else Enter Browse Mode [] End If End If
Create an account or sign in to comment