Are you sure that you are on a layout based on Person? Not on a layout, say, on an occurrence of Person with a different name?
I just double-checked and it is based on Person, not a TO of Person. It is strange that the only lines of code that run between the time it errors out and works is line 3 & 4 of that script. No layout changes, etc. in between.
1. I execute a find on List layout based on Person. It produces the records I want.
2. I click on one of those names that is defined as a button and leads the script in the screenshot.
3. After executing line 2, it gives me the error.
4. I click OK on the error, then click the same name and it works perfectly.
I know it has to be something I've done, but I can't figure it out why it would only error out the first time, then work the second time.
I don't know if this helps at all, but this is the script that runs immediately before the script that produces the error. It runs properly and results in a found set of Person.
Keep in mind that a replace all step will fail to update a record that is open (locked) in another window or by another person on a network without telling you what record was skipped.
If this is important enough using a script that loops through the section of records (or other means) to isolate records that weren't updated is important.
I've never seen that error message except when there's some sort of context problem. FileMaker is basically saying "I can't get there from here".
When you run this from the debugger, do you see the correct, person based, layout in the background at the time the error message appears?
If so, I'd do a test by recovering this file and testing this script in the recovered copy.
Yes, but an edit locked record produces a different error message than that shown here.
I'll try that. Yes, the right layout is showing and that layout is based on
Person. It is the main layout that everything works from. There are no
layout changes in the code. All I do is perform a Find and end up with a
subset of records. When I click on a name, it errors. If I click the same
name a second time, it does what it is supposed to.
I will try a recovery.
Because I was still on test data, I reimported the data for a different reason and this error seems to have gone away. Maybe some type of data corruption, like was suggested? I'm not sure. Still a mystery.
Thanks for the suggestions.