I believe this will work: (Test it to be sure)
Set Error Capture [on]
If [Get ( LastError ) = 0 /* Ok to procede */]
// do your scripted stuff here that you want
Show Custom Dialog [''tell the user why this didn't work"]
Open Record/Request will generate an error if someone else has locked the record or if the user does not have access privileges that permit editing the record.
Exactly what i was looking for.
You might also have been able to incorporate just the set error capture and Get ( lasterror ) portions of the script as you were getting the error message, you just didn't have a means of getting your script to handle the errors effectively. You can also change the code to:
Set Variable [ $ErrorCode ; value Get ( LastError ) ]
and then test use the Number in $ErrorCode to respond to different error codes in different ways.
The thing to watch is that Get ( LastError ) must take place immediately after any step where we want to trap for errors.
(We could really use an OnError type of error handler in filemaker scripts!)
I thought of that solution as well.
And, i totally agree. I mean, i would have thought that it was already incorporated. Which is what i was looking for in the first place.
I've already suggested as much on Filemaker's Suggestion form: http://www.filemaker.com/company/feature_request.html
Any who agree, can use this link to chime in with their own requests to that effect.
For those unfamiliar with OnError as it is implemented in languages such as Visual Basic,
On Error allows you to set up a portion of your script that executes whenever an error condition is encountered after any step in the script is executed.
You can thus have a single section that tests error codes and handles the results instead of starting the script with Set Error Capture and then using Get ( LastError ) over and over again within the script to test for error conditions.