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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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