Jump to content
Sign in to follow this  
nutthick

Find if record missing, without dialog box

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

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